From 4f7b869d4d401b904fb7f7816960d0ba4fd9599e Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Sat, 8 Apr 2023 13:30:40 +0200 Subject: fix group name check instead of obj --- server/views.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'server') diff --git a/server/views.py b/server/views.py index 0ba3f63..2be7966 100644 --- a/server/views.py +++ b/server/views.py @@ -233,13 +233,13 @@ def docapprove(request): messages.append(data[i] + " - Formato errato") elif Document.objects.filter(code=data[i]).count() == 0: messages.append(data[i] + " - Invalido") - elif Document.objects.filter(code=data[i])[0].group.name not in groups: + elif Document.objects.filter(code=data[i])[0].group not in groups: # check if user has permission to approve document messages.append(data[i] + " - Invalido") else: document = Document.objects.filter(code=data[i])[0] - if document.group.name not in groups: + if document.group not in groups: return if document.status != 'wait' and document.status != 'ok': @@ -265,14 +265,14 @@ def docapprove(request): elif Document.objects.filter(code=data).count() == 0: error_text = "Codice invalido" error = True - elif Document.objects.filter(code=data)[0].group.name not in groups: + elif Document.objects.filter(code=data)[0].group not in groups: error_text = "Codice invalido" error = True else: # get document document = Document.objects.filter(code=data)[0] - if document.group.name not in groups: + if document.group not in groups: return if document.status != 'wait' and document.status != 'ok': @@ -342,7 +342,7 @@ def approve_direct(request): return # check if user has permission to approve document - if document.group.name not in groups: + if document.group not in groups: return document.status = "ok" @@ -370,7 +370,7 @@ def approve_direct(request): return render(request, 'server/approve_doc_direct.html', {"error": "Questo documento non รจ in attesa di approvazione"}) # check if user has permission to approve document - if document.group.name not in groups: + if document.group not in groups: return render(request, 'server/approve_doc_direct.html', {"error": "Non hai il permesso di approvare questo documento"}) return render(request, 'server/approve_doc_direct.html', {"doc": document}) @@ -1637,7 +1637,7 @@ def docpreview(request): # get document document = Document.objects.filter(code=code)[0] - doc_group = document.group.name + doc_group = document.group parent_group = document.user.groups.values_list('name', flat=True)[0] # user has not permission to view document @@ -1689,7 +1689,7 @@ def data_request(request): context["data"] = data elif request.POST["request"] == "data_user": perm = Permission.objects.get(codename="approved") - users = User.objects.filter(groups__name=parent_group, user_permissions=perm) + users = User.objects.filter(groups=parent_group, user_permissions=perm) # get time for filename current_time = datetime.strftime(datetime.now(), "%H_%M__%d_%m_%y") @@ -1737,7 +1737,7 @@ def data_request(request): elif request.POST["request"] == "data_user_medic": perm = Permission.objects.get(codename="approved") - users = User.objects.filter(groups__name=parent_group, user_permissions=perm) + users = User.objects.filter(groups=parent_group, user_permissions=perm) # get time for filename current_time = datetime.strftime(datetime.now(), "%H_%M__%d_%m_%y") -- cgit v1.2.1 From 25f8a3e7834867a6ebd4f565d8c2593d585257fe Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Wed, 14 Jun 2023 16:18:27 +0200 Subject: change lazyload library to work with iOS --- server/templates/server/doc_list.html | 22 ++++++++++++++++++---- server/templates/server/doc_list_readonly.html | 22 ++++++++++++++++++---- server/templates/server/user_list.html | 16 +++++++++++++--- 3 files changed, 49 insertions(+), 11 deletions(-) (limited to 'server') diff --git a/server/templates/server/doc_list.html b/server/templates/server/doc_list.html index 06c8893..db1ee4e 100644 --- a/server/templates/server/doc_list.html +++ b/server/templates/server/doc_list.html @@ -437,7 +437,11 @@
- {% if doc.signed_doc %} {% endif %} + {% if doc.signed_doc %} + + {% else %} +

Foto della conferma firmata non caricata

+ {% endif %}
@@ -447,7 +451,11 @@
- {% if doc.medical_data.health_care_certificate %}{% endif %} + {% if doc.medical_data.health_care_certificate %} + + {% else %} +

Foto della tessera della cassa malati non caricata

+ {% endif %}
@@ -456,7 +464,11 @@
- {% if doc.medical_data.vac_certificate %}{% endif %} + {% if doc.medical_data.vac_certificate %} + + {% else %} +

Foto del certificato di vacinazione non caricato

+ {% endif %}
@@ -487,7 +499,9 @@ $(document).ready(function(){ update(); document.getElementById('progress_bar').className = "determinate"; {% endif %} - lazyload(); + var lazyLoadInstance = new LazyLoad({ + // Your custom settings go here + }); }); function resetModal() { diff --git a/server/templates/server/doc_list_readonly.html b/server/templates/server/doc_list_readonly.html index c29fb74..ab80242 100644 --- a/server/templates/server/doc_list_readonly.html +++ b/server/templates/server/doc_list_readonly.html @@ -417,7 +417,11 @@
- {% if doc.signed_doc %} {% endif %} + {% if doc.signed_doc %} + + {% else %} +

Foto della conferma firmata non caricata

+ {% endif %}
@@ -427,7 +431,11 @@
- {% if doc.medical_data.health_care_certificate %}{% endif %} + {% if doc.medical_data.health_care_certificate %} + + {% else %} +

Foto della tessera della cassa malati non caricata

+ {% endif %}
@@ -436,7 +444,11 @@
- {% if doc.medical_data.vac_certificate %}{% endif %} + {% if doc.medical_data.vac_certificate %} + + {% else %} +

Foto del certificato di vacinazione non caricato

+ {% endif %}
@@ -467,7 +479,9 @@ $(document).ready(function(){ update(); document.getElementById('progress_bar').className = "determinate"; {% endif %} - lazyload(); + var lazyLoadInstance = new LazyLoad({ + // Your custom settings go here + }); }); function resetModal() { diff --git a/server/templates/server/user_list.html b/server/templates/server/user_list.html index 6224df7..dffb8b2 100644 --- a/server/templates/server/user_list.html +++ b/server/templates/server/user_list.html @@ -271,7 +271,11 @@
- {% if user.medic.health_care_certificate %}{% endif %} + {% if user.medic.health_care_certificate %} + + {% else %} +

Foto della tessera della cassa malati non caricata

+ {% endif %}
@@ -280,7 +284,11 @@
- {% if user.medic.vac_certificate %}{% endif %} + {% if user.medic.vac_certificate %} + + {% else %} +

Foto del certificato di vacinazione non caricato

+ {% endif %}
@@ -313,7 +321,9 @@ $(document).ready(function(){ $('.modal').modal(); $('.collapsible').collapsible(); - lazyload(); + var lazyLoadInstance = new LazyLoad({ + // Your custom settings go here + }); }); function send(id) { -- cgit v1.2.1 From 038504f7b3c8de52bb314e84dd2517cd8442c770 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Thu, 15 Jun 2023 18:59:49 +0200 Subject: fix missing all query request --- server/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server') diff --git a/server/views.py b/server/views.py index 2be7966..4953a1a 100644 --- a/server/views.py +++ b/server/views.py @@ -1810,7 +1810,7 @@ def media_request(request, id=0, t="", flag=""): usercode = UserCode.objects.get(id=id) if request.user.is_staff: groups = getGroups(request) - usercode_group = usercode.user.groups[0] + usercode_group = list(usercode.user.groups.all())[0] if usercode_group not in groups: return else: -- cgit v1.2.1