Django URL Path Django.How

Author avatar wrote on 07/06/2022

If a word in path Path


{% if 'account' in request.path %}
    hello world!
{% endif %}

Find previous referrer


{{ request.META.HTTP_REFERER }}

 

In view

req.META['HTTP_REFERER'] = 'google.com'
 t = Template("{{ request.META.HTTP_REFERER }}")

 

Redirect in view


from django.http import HttpResponseRedirect

return HttpResponseRedirect('/url/url1/')

 

CRUDgen Django CRUD generator