Taylor wrote: > 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. > > > without even visiting the page that the link > is on by visiting the URL directly. They can only visit the page if you provide an url it. Just don't make any url that displays page without your counter
I don't think I understand what you want, since what I think you want is super trivial. But... def my_view(request): counter = Counter.objects.get(id=someid) counter.count += 1 counter.save() # Or see http://www.djangoproject.com/documentation/request_response/ if you want to use different value/counter based on what page led them to current view. # referer is unreliable refer = request.META.get( "HTTP_REFERER", None) counter = Counter.objects.get(refer=refer) counter.count += 1 counter.save() # do whatever to show view Which is not a great way of doing it (db hit every page view, fails when you start caching results) but those don't matter unless your site is real busy. another option parsing apache/nginx/whatever logs for whenever particular url(s) where responded to. -- Norman J. Harman Jr. 512 912-5939 Technology Solutions Group, Austin American-Statesman ___________________________________________________________________________ Get out and about this spring with the Statesman! In print and online, the Statesman has the area's Best Bets and recreation events. Pick up your copy today or go to statesman.com 24/7. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---