From ec629d14217deaf8713849271abc619ef5acb8cf Mon Sep 17 00:00:00 2001 From: Innocent Zenda Date: Sun, 5 Nov 2023 10:02:27 +0300 Subject: [PATCH] restrict contact views closes #25 --- config/settings.py | 3 ++ .../templates/contacts/contact_form.html | 11 +++++- .../templates/contacts/contact_list.html | 6 ++-- pim/contacts/views.py | 34 +++++++++++++------ static/images/star-2763.svg | 8 ----- static/images/star-7207.svg | 8 ----- templates/account/email_confirm.html | 16 ++++++--- 7 files changed, 51 insertions(+), 35 deletions(-) delete mode 100644 static/images/star-2763.svg delete mode 100644 static/images/star-7207.svg diff --git a/config/settings.py b/config/settings.py index 119e8b1..cc26997 100644 --- a/config/settings.py +++ b/config/settings.py @@ -13,6 +13,7 @@ from decouple import config from django.contrib import messages +from django.urls import reverse_lazy from django.utils.translation import gettext_lazy as _ # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -215,3 +216,5 @@ PHONENUMBER_DEFAULT_REGION = 'TZ' PHONENUMBER_DEFAULT_FORMAT = 'INTERNATIONAL' + +LOGIN_REDIRECT_URL = reverse_lazy('main:home') diff --git a/pim/contacts/templates/contacts/contact_form.html b/pim/contacts/templates/contacts/contact_form.html index b67d136..d4bcd44 100644 --- a/pim/contacts/templates/contacts/contact_form.html +++ b/pim/contacts/templates/contacts/contact_form.html @@ -15,7 +15,16 @@

{% endif %} {% csrf_token %} {{ form | crispy }} - + {% if object %} + + {% else %} + + {% trans 'Cancel' %} + + {% endif %} diff --git a/pim/contacts/templates/contacts/contact_list.html b/pim/contacts/templates/contacts/contact_list.html index 466770c..88c77b2 100644 --- a/pim/contacts/templates/contacts/contact_list.html +++ b/pim/contacts/templates/contacts/contact_list.html @@ -2,9 +2,9 @@