Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django referrer question

I want to know who refers my webpage, so in my models I have:

referrer = models.CharField(max_length=30, default='google',
        verbose_name=_('referrer'), help_text=_('Referrer'))
This are the URL's for my page:
url(r'^$', app_views.index, name='index_default')
and
url(r'^(\w+)/$', app_views.index, name='index_default2')
I want to send my referrer parameter to the flash embeddeded within my HTML along flashvars:
< param name="FlashVars" value="referrer={{ referrer }}" />
How should the view look like in order to catch the referrer matched with the regular expression? Something like
def index(request):
    return render_to_response('index.html',
            {
            'referrer':referrer,
            },
            context_instance=RequestContext(request))
like image 783
Rosario Internullo Avatar asked Mar 03 '26 10:03

Rosario Internullo


1 Answers

in the meta dictionary of request there is a HTTP_REFERER value .. I think that can help you

like image 152
Plaban Nayak Avatar answered Mar 06 '26 00:03

Plaban Nayak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!