[Python] Django Override the Default success_url in contrib.auth.views

Discussão em 'Python' iniciado por Stack, Agosto 16, 2025.

  1. Stack

    Stack Membro Participativo

    I made an app with app_name = 'accounts' in urls.py of the django and created signup/login pages there using the built-in signup function.

    Now I need to change all the class details of the success_url, for instance from:

    reverse_lazy('login')



    to:

    reverse_lazy('accounts:login')



    but overwriting the original urls.py is not a good practice. I'm a python beginner and struggling with this problem already for a month..

    how can I achieve this?

    What I attemptd was making subclasses in my views inherent from each of the class in django.contrib.auth.views.

    I even tried putting try/except method with except 'NoReverseMatch:' but the function itself did not exist.

    Continue reading...

Compartilhe esta Página