Re: Ability to change LoginView inside custom AdminSite

2020-05-15 Thread Dipankar
Read documentation for customization. I hope you need to pass template
parameter and form class. That's all.

On Fri, May 15, 2020 at 7:44 PM Nikita Krokosh  wrote:

> 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.
>
>
>
> --
> 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-developers+unsubscr...@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.

-- 
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-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFdBwp8-RKCY3mqXtq0sEqnBXL2pFNTZNJda_qpOQXCrM_UvQQ%40mail.gmail.com.


Ability to change LoginView inside custom AdminSite

2020-05-15 Thread Nikita Krokosh

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.



--
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-developers+unsubscr...@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.