From 684c019daf76b499417c85e4ea5877a96b0ddb0e Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 23 Jun 2020 19:05:09 +0200 Subject: Nicer user list, multi group support --- .../migrations/0025_documenttype_custom_group.py | 18 ++++ client/models.py | 1 + client/templates/client/approve_doc_pdf.html | 113 ++++++--------------- client/views.py | 4 +- 4 files changed, 52 insertions(+), 84 deletions(-) create mode 100644 client/migrations/0025_documenttype_custom_group.py (limited to 'client') diff --git a/client/migrations/0025_documenttype_custom_group.py b/client/migrations/0025_documenttype_custom_group.py new file mode 100644 index 0000000..56c77f9 --- /dev/null +++ b/client/migrations/0025_documenttype_custom_group.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.7 on 2020-06-23 14:16 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('client', '0024_auto_20200622_1930'), + ] + + operations = [ + migrations.AddField( + model_name='documenttype', + name='custom_group', + field=models.BooleanField(default=False), + ), + ] diff --git a/client/models.py b/client/models.py index 105165b..4d8ae83 100644 --- a/client/models.py +++ b/client/models.py @@ -10,6 +10,7 @@ class DocumentType(models.Model): auto_sign = models.BooleanField(default=False) group_private = models.BooleanField(default=False) group = models.ForeignKey(Group, default=None, on_delete=models.CASCADE) + custom_group = models.BooleanField(default=False) personal_data = models.BooleanField(default=False) medical_data = models.BooleanField(default=False) custom_data = models.BooleanField(default=False) diff --git a/client/templates/client/approve_doc_pdf.html b/client/templates/client/approve_doc_pdf.html index 4b7df8b..deabd99 100644 --- a/client/templates/client/approve_doc_pdf.html +++ b/client/templates/client/approve_doc_pdf.html @@ -2,98 +2,47 @@ + + -
-

{{doc.code}}

-

{{doc.document_type.name}}

-
-

Con la presente firma approvo il documento con codice {{doc.code}} accettando - tutte le clausole apposte su di esso. - Inoltre comprovo come veritieri e completi tutti i dati apposti sul documento. -

+



+



+
+

{{doc.code}}

+
+
+

{{doc.document_type.name}}

+
+
+
+

Con la presente firma approvo il documento con codice {{doc.code}} accettando + tutte le clausole apposte su di esso. + Inoltre comprovo come veritieri e completi tutti i dati apposti sul documento. +

+
















-
- - - - - -

Data

Firma

+
+
+
+ + Data e luogo +
+
+
+
+ + Firma +
+
+ \ No newline at end of file diff --git a/client/views.py b/client/views.py index b43a3c9..17d9e0a 100644 --- a/client/views.py +++ b/client/views.py @@ -92,7 +92,7 @@ def approve(request): if not (request.user.is_staff or request.user.has_perm('approved')): usercode = UserCode.objects.filter(user=request.user)[0] okay = False - if request.user.first_name != "" and request.user.last_name != "" and request.user.email != "" and len(request.user.groups.values_list('name', flat=True)) != 0: + if request.user.first_name != "" and request.user.last_name != "" and request.user.email != "" and usercode.phone != "": okay = True context = {'code': 'U' + str(usercode.code), 'okay': okay} return render(request, 'client/approve.html', context) @@ -162,7 +162,7 @@ def create(request): break document = Document( - user=request.user, group=group, code=code, status=status, document_type=document_type, personal_data=personal_data, medical_data=medical_data) + user=request.user, group=document_type.group, code=code, status=status, document_type=document_type, personal_data=personal_data, medical_data=medical_data) document.save() if document_type.custom_data: -- cgit v1.2.1