Does something exist so that a link on a page performs an action rather than just showing a view? For example: I have a counter saved to the db, and every time a user clicks the link, the counter increases by a certain number and saves.
I know that I could create a URL that takes in a parameter and update the counter in the view, so the link points to /count/3 and the view then updates the counter by 3. This is a bad solution because the counter would update even if the user refreshes the page, and the user could update the counter without even visiting the page that the link is on by visiting the URL directly. It seems that the other option I can find is to make every link into a POST form and include a hidden control that contains the number I want to update by. However, if the page has 12 links on it, all with different numbers, this means that it would have at least 12 forms and it isn't as elegant to wrap all of these links in forms and deal with the javascript hoops that allow a link to submit a form. While the second option works, I'm hoping there's something better out there. Maybe an add-on or application or something I can import or look at the code. Does anyone know of anything that does this? I realize that this isn't natively supported by HTTP so it isn't easy since it would probably require some background javascript and HttpRequest magic or something, but I was wondering if anyone has solved this problem. If not, I think this would be a great addition to django. Many frameworks are adding things like this, and I would gladly fill out a ticket requesting this. Thanks a bunch, Taylor --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---