diff --git a/djangoTest/settings.py b/djangoTest/settings.py index a48c2f6..17d997a 100644 --- a/djangoTest/settings.py +++ b/djangoTest/settings.py @@ -123,3 +123,5 @@ STATIC_URL = 'static/' # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +LOGIN_REDIRECT_URL = '/polls' diff --git a/djangoTest/urls.py b/djangoTest/urls.py index aee2da7..a1e3449 100644 --- a/djangoTest/urls.py +++ b/djangoTest/urls.py @@ -23,4 +23,5 @@ urlpatterns = [ path('polls/', include('polls.urls')), path('admin/', admin.site.urls), + path('', include('django.contrib.auth.urls')), ] diff --git a/polls/templates/registration/login.html b/polls/templates/registration/login.html new file mode 100644 index 0000000..8abdccd --- /dev/null +++ b/polls/templates/registration/login.html @@ -0,0 +1,40 @@ +{% extends "base.html" %} + +{% block title %}Login{% endblock %} + +{% block content %} + +{% if form.errors %} +
Your username and password didn't match. Please try again.
+{% endif %} + +{% if next %} + {% if user.is_authenticated %} +Your account doesn't have access to this page. To proceed, + please login with an account that has access.
+ {% else %} +Please login to see this page.
+ {% endif %} +{% endif %} + + + +{# Assumes you set up the password_reset view in your URLconf #} + + +{% endblock %}