djangosnippets.org: Latest snippets tagged with 'http_referer'https://djangosnippets.org/tags/http_referer/2008-12-10T02:22:32.982027-06:00Search Engine Referrer info in request
2008-12-10T02:22:32.982027-06:00zenxhttps://djangosnippets.org/snippets/1240/<p>This is exacly the same snippet as #197 http://www.djangosnippets.org/snippets/197/ but returning search enigne, search engine domain and search term in:
request.search_referrer_engine
request.search_referrer_domain
request.search_referrer_term</p>
<p>I wanted to show ads only to people comming from search engines so I took snippet #197 and modify it to put that info in the request …</p>
Freely redistributableReferer-checking view decorators
2007-04-15T13:51:06.949609-05:00robbiehttps://djangosnippets.org/snippets/179/<p>Here are a couple of Django decorators for limiting access to a view based on the request's <code>HTTP_REFERER</code>. Both raise a Django <code>PermissionDenied</code> exception if the referer test fails (or a referer simply isn't provided).
</p>
<p>The first, <code>referer_matches_hostname</code>, takes a hostname (and port, if specified) and matches it …</p>
Freely redistributable