I've been trying to find the previous url following this answer:
Django request to find previous referrer
So, in my .py I did:
print request.META
print request.META.HTTP_REFERER
print request.META['HTTP_REFERER']
request.META returns:
{'RUN_MAIN': 'true', 'HTTP_REFERER': 'http://127.0.0.1:8000/info/contact/', 'XDG_GREETER_DATA_DIR': '/var/lib/lightdm-data/user', 'QT4_IM_MODULE': 'xim',....
So, I can see HTTP_REFERER is there, but when trying to access it either way I get the error:
<type 'exceptions.AttributeError'>
'dict' object has no attribute 'HTTP_REFERER'
How can I access it?
I would suggest:
request.META.get('HTTP_REFERER')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With