From 65a2e8c08c5dcccf2438773a1bc874e73d197b94 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Wed, 7 Oct 2020 11:29:52 +0200 Subject: [PATCH] Better index page: non-Kfet members will be redirected to their profile page, the account note (when it will be managed) will see the consumption page --- note_kfet/settings/base.py | 2 +- note_kfet/templates/base.html | 3 ++- note_kfet/urls.py | 5 ++--- note_kfet/views.py | 30 ++++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 note_kfet/views.py diff --git a/note_kfet/settings/base.py b/note_kfet/settings/base.py index f319b2db..f94a68e0 100644 --- a/note_kfet/settings/base.py +++ b/note_kfet/settings/base.py @@ -245,7 +245,7 @@ REST_FRAMEWORK = { FORM_RENDERER = 'django.forms.renderers.TemplatesSetting' # After login redirect user to transfer page -LOGIN_REDIRECT_URL = '/note/transfer/' +LOGIN_REDIRECT_URL = '/' # An user session will expired after 3 hours SESSION_COOKIE_AGE = 60 * 60 * 3 diff --git a/note_kfet/templates/base.html b/note_kfet/templates/base.html index e597d5ca..1e740012 100644 --- a/note_kfet/templates/base.html +++ b/note_kfet/templates/base.html @@ -64,7 +64,8 @@ SPDX-License-Identifier: GPL-3.0-or-later {% trans 'Consumptions' %} {% endif %} - {% if "note.transaction"|not_empty_model_list %} + {# FIXME Find a better solution to check if a user has the right to see the transfer page #} + {% if "note.alias"|model_list_length >= 2 %}