'How to override the default authentication form in django

I've been trying to override the authentication form, i ve inherited from the authenticationform class

how do i make the loginview to use my custom form



Solution 1:[1]

You can set a custom form as the authentication_form in your urls.py:

from django.urls import path
from django.contrib.auth import views
from profiles.forms import UserLoginForm

urlpatterns = [
    path('login/',
        views.LoginView.as_view(
            template_name="registration/login.html",
            authentication_form=UserLoginForm,
            ),
        name='login'
    ),

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SamSparx