Ability to change LoginView inside custom AdminSite

40 views
Skip to first unread message

Nikita Krokosh

unread,
May 15, 2020, 10:14:06 AM5/15/20
to django-d...@googlegroups.com

Hello everyone.


There's a way to set your own AdminSite class as said in docs:

https://docs.djangoproject.com/en/3.0/ref/contrib/admin/#overriding-the-default-admin-site


But I also want to change login view behavior.

I want to replace LoginView in

    django.contrib.admin.sites.AdminSite.login

method (by analogy with for example login_form parameter in the same AdminSite class).


I need it to write custom logic in form_valid method, and it looks dirty and unnecessary to copy-paste whole login view code.

Can project code be improved this way?


Best Regards.



Dipankar

unread,
May 15, 2020, 10:23:27 PM5/15/20
to django-d...@googlegroups.com
Read documentation for customization. I hope you need to pass template parameter and form class. That's all.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/0a5f010a-df61-a7ce-e62f-281108c8dfd8%40gmail.com.


--
Warm Regards,
Dipankar B.
Reply all
Reply to author
Forward
0 new messages