From f9f7f624b1b5e721a3b0375015f6a01c1b94b8c2 Mon Sep 17 00:00:00 2001 From: ahosking Date: Thu, 1 Jun 2023 18:45:52 -0400 Subject: [PATCH] Enable Accounts --- api/api/settings.py | 6 +- api/api/templates/base.html | 65 ++++++++++++++++++++++ api/api/templates/home.html | 13 +++++ api/api/templates/index.html | 14 ++++- api/api/templates/registration/login.html | 13 +++++ api/api/templates/registration/signup.html | 13 +++++ api/api/urls.py | 9 ++- 7 files changed, 125 insertions(+), 8 deletions(-) create mode 100644 api/api/templates/base.html create mode 100644 api/api/templates/home.html create mode 100644 api/api/templates/registration/login.html create mode 100644 api/api/templates/registration/signup.html diff --git a/api/api/settings.py b/api/api/settings.py index 1066560..a3bcbc4 100644 --- a/api/api/settings.py +++ b/api/api/settings.py @@ -11,7 +11,6 @@ https://docs.djangoproject.com/en/3.2/ref/settings/ """ from pathlib import Path -import environ import os import environ @@ -51,6 +50,7 @@ INSTALLED_APPS = [ 'rest_framework', 'rest_framework.authtoken', 'django_filters', + 'accounts', ] @@ -185,3 +185,7 @@ STATICFILES_DIRS = [ BASE_DIR / "api/static", ("assets", BASE_DIR / "api/static/assets"), ] + + +LOGIN_REDIRECT_URL = "index" +LOGOUT_REDIRECT_URL = "index" diff --git a/api/api/templates/base.html b/api/api/templates/base.html new file mode 100644 index 0000000..c07b1a7 --- /dev/null +++ b/api/api/templates/base.html @@ -0,0 +1,65 @@ +{% load static %} + + + + + + Bootstrap demo + + + +
+
+
+ + + + + + + + +
+ {% if user.is_authenticated %} + Logout + {% else %} + Login + Sign-up + {% endif %} + + +
+
+
+
+ + +
+ +
+ {% block content %} +

{{ section.title }}

+ +{% for story in story_list %} +

+ + {{ story.headline|upper }} + +

+

{{ story.tease|truncatewords:"100" }}

+{% endfor %} +{% endblock %} + +
+ +
+ + diff --git a/api/api/templates/home.html b/api/api/templates/home.html new file mode 100644 index 0000000..d949451 --- /dev/null +++ b/api/api/templates/home.html @@ -0,0 +1,13 @@ + +{% extends 'base.html' %} + +{% block title %}Home{% endblock %} + +{% block content %} +{% if user.is_authenticated %} + Hi {{ user.username }}! +{% else %} +

You are not logged in

+ Log In +{% endif %} +{% endblock %} \ No newline at end of file diff --git a/api/api/templates/index.html b/api/api/templates/index.html index ed54fda..fb89941 100644 --- a/api/api/templates/index.html +++ b/api/api/templates/index.html @@ -28,8 +28,14 @@
- - + {% if user.is_authenticated %} + Logout + {% else %} + Login + Sign-up + {% endif %} + +
@@ -39,6 +45,7 @@
+

Bills

Quickly and easily start adding your bills and service costs to get a better understanding of your operational expenses.

@@ -74,8 +81,11 @@
+{% block base %} +{% endblock %} +