On Apr 27, 9:42 am, Alessandro Ronchi <alessandro.ron...@soasi.com> wrote: > Is it possible to check in a django template if a request is from a spider/ > bot or not? > > -- > Alessandro Ronchi >
As long as you use a RequestContext to render your template, and the tag itself has access to the `request` object - either passed explicitly, or by using `takes_context=True` in an inclusion tag, then you can check the value of `request.META['HTTP_USER_AGENT']` to see what made the request. There's a list of robot user agent strings here: http://www.robotstxt.org/db.html -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.