diff options
author | Andrea Lepori <alepori@student.ethz.ch> | 2022-01-31 17:10:39 +0100 |
---|---|---|
committer | Andrea Lepori <alepori@student.ethz.ch> | 2022-01-31 17:11:17 +0100 |
commit | 7b3ff4bacab76138a45f018fcfee055c8fd1f186 (patch) | |
tree | c841299beeb9516ed4cb8f67072fca86d661dc02 /accounts/views.py | |
parent | fix chrome showing white page on production (diff) | |
download | scout-subs-7b3ff4bacab76138a45f018fcfee055c8fd1f186.tar.gz scout-subs-7b3ff4bacab76138a45f018fcfee055c8fd1f186.zip |
add go home message after saving data and other warning
Diffstat (limited to '')
-rw-r--r-- | accounts/views.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/accounts/views.py b/accounts/views.py index dad6075..a2381af 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -510,7 +510,7 @@ def personal_wrapper(request, errors): # if there wasn't any error redirect to clear POST if len(errors) == 0: - return HttpResponseRedirect(request.path_info) + return HttpResponseRedirect(request.get_full_path()) else: # no post, create empty validation @@ -568,10 +568,17 @@ 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 + print(errors) + 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, @@ -625,6 +632,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) |