diff --git a/.gitignore b/.gitignore index 62c8935..8ad47b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.idea/ \ No newline at end of file +.idea/ +db.sqlite3 \ No newline at end of file diff --git a/keeppolling/settings.py b/keeppolling/settings.py index 62ba8d5..5bfa467 100644 --- a/keeppolling/settings.py +++ b/keeppolling/settings.py @@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/5.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/5.0/ref/settings/ """ - +import os from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -56,7 +56,9 @@ ROOT_URLCONF = 'keeppolling.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [ + os.path.join(BASE_DIR, 'templates'), + ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -131,3 +133,7 @@ STATIC_ROOT = BASE_DIR / "staticfiles" # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +# Where to redirect after Login +LOGIN_REDIRECT_URL = "landing" +LOGOUT_REDIRECT_URL = "login" diff --git a/keeppolling/urls.py b/keeppolling/urls.py index dd6f80c..d07df15 100644 --- a/keeppolling/urls.py +++ b/keeppolling/urls.py @@ -15,8 +15,17 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path +from django.urls import path, include urlpatterns = [ - path('admin/', admin.site.urls), + path( + 'admin/', + admin.site.urls, + ), + path( + "accounts/", + include( + "django.contrib.auth.urls", + ), + ), ] diff --git a/static/css/style.css b/static/css/style.css new file mode 100644 index 0000000..e69de29 diff --git a/templates/base_template.html b/templates/base_template.html new file mode 100644 index 0000000..8788036 --- /dev/null +++ b/templates/base_template.html @@ -0,0 +1,34 @@ + + + + {% block title %} + Keep pollin', pollin', pollin', pollin' + {% endblock %} + + + + + + {% load static %} + + + + + + {% block extra-head %}{% endblock %} + + + +
+ {% block content %}{% endblock %} +
+ + diff --git a/templates/registration/login.html b/templates/registration/login.html new file mode 100644 index 0000000..ee0508a --- /dev/null +++ b/templates/registration/login.html @@ -0,0 +1,43 @@ +{% extends "base_template.html" %} + +{% block content %} + +
Login
+ +{% 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 %} + +
+{% csrf_token %} +
+
{{ form.username.label_tag }}
+
{{ form.username }}
+
+
+
{{ form.password.label_tag }}
+
{{ form.password }}
+
+
+ Login +
+ + +
+ +{% endblock %} \ No newline at end of file