aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2020-07-26 21:28:06 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2020-07-26 21:28:06 +0200
commite1deaaf4a239db742cea2d1e6c4f48a9656d8a0f (patch)
treec3bbe11e47616f702f4c56734430005a5fc04504 /accounts
parentuse webp to save images (diff)
downloadscout-subs-e1deaaf4a239db742cea2d1e6c4f48a9656d8a0f.tar.gz
scout-subs-e1deaaf4a239db742cea2d1e6c4f48a9656d8a0f.zip
bug fixes and visual improvements
Diffstat (limited to 'accounts')
-rw-r--r--accounts/templates/accounts/index.html21
-rw-r--r--accounts/views.py10
2 files changed, 23 insertions, 8 deletions
diff --git a/accounts/templates/accounts/index.html b/accounts/templates/accounts/index.html
index 9a8a79c..69d0717 100644
--- a/accounts/templates/accounts/index.html
+++ b/accounts/templates/accounts/index.html
@@ -75,7 +75,7 @@
<label for="birth_date">Data di nascita</label>
</div>
<div class="input-field col l4 s12">
- <select name="branca">
+ <select name="branca" disabled>
<option value="" disabled {{branca_default}}>Scegli</option>
<option value="colonia" {{branca_castorini}}>Castorini</option>
<option value="muta" {{branca_lupetti}}>Lupetti</option>
@@ -278,7 +278,7 @@
<div class="file-field input-field">
<div class="btn teal">
<span><i class="material-icons left">file_upload</i>File</span>
- <input type="file" name="vac_certificate">
+ <input type="file" name="vac_certificate" id="vac_certificate">
</div>
<div class="file-path-wrapper">
<input id="vac_file" value="{{vac_certificate}}" class="file-path" type="text" placeholder="Certificato di vacinazione">
@@ -298,7 +298,7 @@
<div class="file-field input-field">
<div class="btn teal">
<span><i class="material-icons left">file_upload</i>File</span>
- <input type="file" name="health_care_certificate">
+ <input type="file" name="health_care_certificate" id="health_care_certificate">
</div>
<div class="file-path-wrapper">
<input id="health_care_file" value="{{health_care_certificate}}" class="file-path" type="text" placeholder="Tessera cassa malati">
@@ -377,6 +377,21 @@ $(document).ready(function() {
{% if error %}
M.toast({html: '{{ error_text}}', classes: 'orange'})
{% endif %}
+
+ document.getElementById("vac_certificate").onchange = function() {
+ if(this.files[0].size > 1048576*10){
+ M.toast({html: 'Il file è troppo grande. Grandezza massima 10MB', classes: 'orange'});
+ this.value = "";
+ }
+ };
+
+ document.getElementById("health_care_certificate").onchange = function() {
+ if(this.files[0].size > 1048576*10){
+ M.toast({html: 'Il file è troppo grande. Grandezza massima 10MB', classes: 'orange'});
+ this.value = "";
+ }
+ };
+
});
/*!
diff --git a/accounts/views.py b/accounts/views.py
index 562524e..cc402d2 100644
--- a/accounts/views.py
+++ b/accounts/views.py
@@ -86,11 +86,11 @@ def personal(request):
medic.misc = request.POST["misc"]
medic.save()
- if "branca" in request.POST:
- if request.POST["branca"] != "":
- request.user.groups.clear()
- request.user.groups.add(
- Group.objects.get(name=request.POST["branca"]))
+ #if "branca" in request.POST:
+ # if request.POST["branca"] != "":
+ # request.user.groups.clear()
+ # request.user.groups.add(
+ # Group.objects.get(name=request.POST["branca"]))
if "vac_certificate" in request.FILES:
myfile = request.FILES['vac_certificate']