From d20c71fd3bea17ab88f45985196e266668620615 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 11 Jan 2022 15:01:43 +0100 Subject: increase max char count for additional fields --- client/models.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'client') diff --git a/client/models.py b/client/models.py index cd3cf88..e01fe1f 100644 --- a/client/models.py +++ b/client/models.py @@ -15,7 +15,7 @@ class DocumentType(models.Model): medical_data = models.BooleanField(default=False) custom_data = models.BooleanField(default=False) custom_message = models.BooleanField(default=False) - custom_message_text = models.CharField(default="", max_length=250) + custom_message_text = models.CharField(default="", max_length=2048) staff_only = models.BooleanField(default=False) max_instances = models.IntegerField(default=0) name = models.CharField(default="", max_length=250) @@ -88,15 +88,15 @@ class Document(models.Model): class KeyVal(models.Model): container = models.ForeignKey( Document, db_index=True, on_delete=models.CASCADE) - key = models.CharField(max_length=240, db_index=True) - value = models.CharField(max_length=240, db_index=True) + key = models.CharField(max_length=2048, db_index=True) + value = models.CharField(max_length=2048, db_index=True) class Keys(models.Model): container = models.ForeignKey( DocumentType, db_index=True, on_delete=models.CASCADE) - key = models.CharField(max_length=240, db_index=True) - key_extra = models.CharField(max_length=1024, default="") + key = models.CharField(max_length=2048, db_index=True) + key_extra = models.CharField(max_length=2048, default="") class UserCode(models.Model): -- cgit v1.2.1 From 76ce07ad01474f8da04a877a6e6f0895a5829c89 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 11 Jan 2022 15:03:32 +0100 Subject: create db migrations --- client/migrations/0014_auto_20220111_1503.py | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 client/migrations/0014_auto_20220111_1503.py (limited to 'client') diff --git a/client/migrations/0014_auto_20220111_1503.py b/client/migrations/0014_auto_20220111_1503.py new file mode 100644 index 0000000..99c7c18 --- /dev/null +++ b/client/migrations/0014_auto_20220111_1503.py @@ -0,0 +1,38 @@ +# Generated by Django 3.1.4 on 2022-01-11 14:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('client', '0013_keys_key_extra'), + ] + + operations = [ + migrations.AlterField( + model_name='documenttype', + name='custom_message_text', + field=models.CharField(default='', max_length=2048), + ), + migrations.AlterField( + model_name='keys', + name='key', + field=models.CharField(db_index=True, max_length=2048), + ), + migrations.AlterField( + model_name='keys', + name='key_extra', + field=models.CharField(default='', max_length=2048), + ), + migrations.AlterField( + model_name='keyval', + name='key', + field=models.CharField(db_index=True, max_length=2048), + ), + migrations.AlterField( + model_name='keyval', + name='value', + field=models.CharField(db_index=True, max_length=2048), + ), + ] -- cgit v1.2.1 From 77dfb2dd619863cf2a18893aa5f3de03b7eaa006 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 11 Jan 2022 15:21:12 +0100 Subject: correct linebreaks written in python --- client/templates/client/approve_doc_pdf.html | 2 +- client/templates/client/doc_create.html | 6 +++--- client/templates/client/doc_edit.html | 2 +- client/templates/client/index.html | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'client') diff --git a/client/templates/client/approve_doc_pdf.html b/client/templates/client/approve_doc_pdf.html index 3ed4d86..ae993f0 100644 --- a/client/templates/client/approve_doc_pdf.html +++ b/client/templates/client/approve_doc_pdf.html @@ -29,7 +29,7 @@

Inoltre accetto e prendo nota della seguente clausula aggiuntiva:
- {{doc.document_type.custom_message_text}} + {{doc.document_type.custom_message_text | linebreaksbr}} {% endif %}

diff --git a/client/templates/client/doc_create.html b/client/templates/client/doc_create.html index ce5f39d..c1db432 100644 --- a/client/templates/client/doc_create.html +++ b/client/templates/client/doc_create.html @@ -98,9 +98,9 @@
-
-

- {{custom_message_text}} +

+

+ {{custom_message_text | linebreaksbr}}

diff --git a/client/templates/client/doc_edit.html b/client/templates/client/doc_edit.html index a9cc056..3af3584 100644 --- a/client/templates/client/doc_edit.html +++ b/client/templates/client/doc_edit.html @@ -56,7 +56,7 @@

- {{custom_message_text}} + {{custom_message_text | linebreaksbr}}

diff --git a/client/templates/client/index.html b/client/templates/client/index.html index e31ce34..1885dd1 100644 --- a/client/templates/client/index.html +++ b/client/templates/client/index.html @@ -76,7 +76,7 @@

Inoltre accetto e prendo nota della seguente clausula aggiuntiva:
- {{doc.document_type.custom_message_text}} + {{doc.document_type.custom_message_text | linebreaksbr}} {% endif %}

-- cgit v1.2.1 From 1f17a13b6f8069d04fc4d172e5a891fc3e7a7c7d Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 11 Jan 2022 15:52:19 +0100 Subject: remove linebrakes on approve doc pdf --- client/templates/client/approve_doc_pdf.html | 3 --- 1 file changed, 3 deletions(-) (limited to 'client') diff --git a/client/templates/client/approve_doc_pdf.html b/client/templates/client/approve_doc_pdf.html index ae993f0..db1478e 100644 --- a/client/templates/client/approve_doc_pdf.html +++ b/client/templates/client/approve_doc_pdf.html @@ -35,9 +35,6 @@




-



-



-



-- cgit v1.2.1 From 7b3ff4bacab76138a45f018fcfee055c8fd1f186 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Mon, 31 Jan 2022 17:10:39 +0100 Subject: add go home message after saving data and other warning --- client/templates/client/doc_create.html | 12 ++++++++++++ client/templates/client/doc_edit.html | 12 ++++++++++++ 2 files changed, 24 insertions(+) (limited to 'client') diff --git a/client/templates/client/doc_create.html b/client/templates/client/doc_create.html index c1db432..71bdbbe 100644 --- a/client/templates/client/doc_create.html +++ b/client/templates/client/doc_create.html @@ -133,6 +133,18 @@ {% endif %} {% endfor %} {% endif %} +
+
+
+
+

+ Attenzione: il documento non sarĂ  valido fino a quando non viene approvato. Selezionare + il documento dalla pagina principale per approvarlo. +

+
+
+
+

diff --git a/client/templates/client/doc_edit.html b/client/templates/client/doc_edit.html index 3af3584..40deb26 100644 --- a/client/templates/client/doc_edit.html +++ b/client/templates/client/doc_edit.html @@ -96,6 +96,18 @@ {% endif %} {% endfor %} {% endif %} +
+
+
+
+

+ Attenzione: il documento non sarĂ  valido fino a quando non viene approvato. Selezionare + il documento dalla pagina principale per approvarlo. +

+
+
+
+

-- cgit v1.2.1 From abc10a25b4d4d16fe03365c65cb72abe4cc44369 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Wed, 23 Mar 2022 16:30:16 +0100 Subject: in case of error redirect to home page --- client/views.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'client') diff --git a/client/views.py b/client/views.py index 0f1bfaa..5333ddb 100644 --- a/client/views.py +++ b/client/views.py @@ -61,10 +61,10 @@ def index(request): # check if document is valid to modify if document.user != request.user: - return + return HttpResponseRedirect("/") if document.status == "ok" or document.status == "archive": - return + return HttpResponseRedirect("/") # execute action if request.POST["action"][0] == 'f': @@ -184,22 +184,22 @@ def create(request): if document_type.max_instances != 0: if len(Document.objects.filter(document_type=document_type)) - len(Document.objects.filter(document_type=document_type, status="archive")) >= document_type.max_instances: # there aren't user is cheating - return + return HttpResponseRedirect("/") # check if user has permission to use that type if document_type.staff_only and not request.user.is_staff and "capi" not in request.user.groups.values_list('name', flat = True): # user is cheating abort - return + return HttpResponseRedirect("/") if not document_type.custom_group and document_type.group.name not in request.user.groups.values_list('name', flat=True): # user is cheating abort - return + return HttpResponseRedirect("/") # get list of docs with that type current_docs = Document.objects.filter(user=request.user).filter(document_type=document_type) if len(current_docs) > 0: # if there is already a document with that type abort (user is cheating) - return + return HttpResponseRedirect("/") # set default values code = 0 @@ -267,12 +267,12 @@ def edit_wrapper(request, context): # check if user has permission if document.user != request.user: - return + return HttpResponseRedirect("/") # check if document is editable if document.status != "wait" and document.status != "autosign": # user is cheating - return + return HttpResponseRedirect("/") # update compilation date document.compilation_date = pytz.timezone('Europe/Zurich').localize(datetime.now()) -- cgit v1.2.1