aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2024-01-28 12:52:55 +0100
committerAndrea Lepori <alepori@student.ethz.ch>2024-01-28 12:52:55 +0100
commit65ebc99e76becf72a40dc1c1f4b420ceeedc1a98 (patch)
tree600aabf2684c613a33ee060ce4602d1ed8821be2 /accounts
parentfix missing date warning (diff)
downloadscout-subs-65ebc99e76becf72a40dc1c1f4b420ceeedc1a98.tar.gz
scout-subs-65ebc99e76becf72a40dc1c1f4b420ceeedc1a98.zip
use usercode id instead of code
Diffstat (limited to '')
-rw-r--r--accounts/templates/accounts/user_edit.html2
-rw-r--r--accounts/views.py8
2 files changed, 7 insertions, 3 deletions
diff --git a/accounts/templates/accounts/user_edit.html b/accounts/templates/accounts/user_edit.html
index 3c4cada..a2d0b3b 100644
--- a/accounts/templates/accounts/user_edit.html
+++ b/accounts/templates/accounts/user_edit.html
@@ -15,7 +15,7 @@
</div>
</div>
-<form action="{% url 'edit_user' code=ucode %}?saved=true" method="post" id="form1" enctype="multipart/form-data">
+<form action="{% url 'edit_user' code=ucode_id %}?saved=true" method="post" id="form1" enctype="multipart/form-data">
<div id="personal" class="row">
<div class="col l8 offset-l2 s12">
<div class="card-panel">
diff --git a/accounts/views.py b/accounts/views.py
index c174fe8..a68e3c4 100644
--- a/accounts/views.py
+++ b/accounts/views.py
@@ -451,8 +451,9 @@ def edit(request, code):
# if render before save this is a dummy never used
medic = MedicalData()
usercode = [UserCode(user=request.user, code=code, medic=medic, branca=None)]
+ code = 0
else:
- usercode = UserCode.objects.filter(code=code)
+ usercode = UserCode.objects.filter(id=code)
if (len(usercode) == 0):
# no avaiable code, create dummy
@@ -741,10 +742,13 @@ def edit(request, code):
# show tooltip only if user is not approved and there are no errors
home_tooltip = (len(errors) == 0)
- print("date", usercode.born_date)
+ ucode_id = usercode.id
+ if ucode_id == None:
+ ucode_id = 0
# fill context
context = {
+ 'ucode_id': ucode_id,
'ucode': code,
'validation_dic': validation_dic,
'first_name': usercode.first_name,