Login.html
<form method="POST">
{% csrf_token %}
{{ form }}
<button type="submit" class="btn btn-outline-info">LOGIN</button>
<a href="{% url 'register' %}">SIGN UP</a>
</form>
urls.py (main project)
from django.contrib import admin
from django.urls import path
from django.contrib.auth import views as user_views
urlpatterns = [
path('admin/', admin.site.urls),
path('login/',user_views.LoginView.as_view(template_name='app/login.html'),name='login'),
path('logout/',user_views.LogoutView.as_view(),name='logout'),
]
setting.py
LOGIN_REDIRECT_URL = 'home' ('Put your URL you want to redirect')
LOGOUT_REDIRECT_URL = 'login' ('Put your URL you want to redirect')
Enjoy !!
Top comments (0)