diff options
author | Andrea Lepori <alepori@student.ethz.ch> | 2022-03-23 19:24:09 +0100 |
---|---|---|
committer | Andrea Lepori <alepori@student.ethz.ch> | 2022-03-23 19:24:21 +0100 |
commit | 7dfc0383561cb9f13282e7779b919f5b17859f86 (patch) | |
tree | d2f3ed554dfd259025845c7f93e02254e1a8beb3 /accounts/views.py | |
parent | initial support of user switcher (diff) | |
parent | in case of error redirect to home page (diff) | |
download | scout-subs-7dfc0383561cb9f13282e7779b919f5b17859f86.tar.gz scout-subs-7dfc0383561cb9f13282e7779b919f5b17859f86.zip |
Merge branch 'master' into dev
Diffstat (limited to '')
-rw-r--r-- | accounts/views.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/accounts/views.py b/accounts/views.py index e9d2bfe..9f7c9b3 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -29,6 +29,13 @@ from pdf2image.exceptions import ( PDFSyntaxError ) +# suppress warning about dateparser deprecated dependencies +import warnings +warnings.filterwarnings( + "ignore", + message="The localize method is no longer necessary, as this time zone supports the fold attribute", +) + oauth = OAuth() hitobito = oauth.register(name="hitobito") api_url = settings.AUTHLIB_OAUTH_CLIENTS["hitobito"]["api_url"] @@ -578,7 +585,7 @@ def personal_wrapper(request, errors): # if there wasn't any error redirect to clear POST if len(errors) == 0: - return HttpResponseRedirect("") + return HttpResponseRedirect(request.get_full_path()) else: # no post, create empty validation @@ -636,10 +643,16 @@ def personal_wrapper(request, errors): if midata_user: midata_disable = " readonly disabled" if not copy_from_midata(request, usercode): - return HttpResponseRedirect(request.path_info) + return HttpResponseRedirect(request.get_full_path()) usable_password = request.user.has_usable_password() + # check if user has saved the form + home_tooltip = False + if "saved" in request.GET: + # show tooltip only if user is not approved and there are no errors + home_tooltip = (not request.user.has_perm("client.approved")) and (len(errors) == 0) + # fill context context = { 'validation_dic': validation_dic, @@ -693,6 +706,7 @@ def personal_wrapper(request, errors): 'settings_active': settings_active, 'personal_active': personal_active, 'midata_enabled': MIDATA_ENABLED, + 'home_tooltip': home_tooltip, } return render(request, 'accounts/index.html', context) |