diff options
-rw-r--r-- | archaeological_operations/forms.py | 6 | ||||
-rw-r--r-- | archaeological_operations/migrations/0067_auto_20190915_1856.py | 35 | ||||
-rw-r--r-- | archaeological_operations/models.py | 4 | ||||
-rw-r--r-- | archaeological_operations/templates/ishtar/sheet_operation.html | 4 | ||||
-rw-r--r-- | ishtar_common/tests.py | 31 |
5 files changed, 64 insertions, 16 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 8ddd42708..d86eb2085 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -1028,6 +1028,12 @@ class CourtOrderedSeizureForm(CustomForm, IshtarForm): name_of_the_protagonist = forms.CharField( label=_(u"Name of the protagonist"), required=False, ) + applicant_authority = forms.CharField( + label=_("Applicant authority"), required=False, + ) + minutes_writer = forms.CharField( + label=_("Writer of the minutes"), required=False, + ) class CollaboratorForm(CustomForm, IshtarForm): diff --git a/archaeological_operations/migrations/0067_auto_20190915_1856.py b/archaeological_operations/migrations/0067_auto_20190915_1856.py new file mode 100644 index 000000000..45fcff1d6 --- /dev/null +++ b/archaeological_operations/migrations/0067_auto_20190915_1856.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-09-15 18:56 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_operations', '0066_auto_20190910_1323'), + ] + + operations = [ + migrations.AddField( + model_name='historicaloperation', + name='applicant_authority', + field=models.TextField(blank=True, null=True, verbose_name='Applicant authority'), + ), + migrations.AddField( + model_name='historicaloperation', + name='minutes_writer', + field=models.TextField(blank=True, null=True, verbose_name='Writer of the minutes'), + ), + migrations.AddField( + model_name='operation', + name='applicant_authority', + field=models.TextField(blank=True, null=True, verbose_name='Applicant authority'), + ), + migrations.AddField( + model_name='operation', + name='minutes_writer', + field=models.TextField(blank=True, null=True, verbose_name='Writer of the minutes'), + ), + ] diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 601779e49..07016a5e8 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -1050,6 +1050,10 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem, QRCodeItem, blank=True, null=True) name_of_the_protagonist = models.TextField(_("Name of the protagonist"), blank=True, null=True) + applicant_authority = models.TextField(_("Applicant authority"), + blank=True, null=True) + minutes_writer = models.TextField(_("Writer of the minutes"), + blank=True, null=True) cached_towns_label = models.TextField( _("Cached town label"), blank=True, null=True, help_text=_("Generated automatically - do not edit") diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index cc556a9fd..e12742aa9 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -239,12 +239,14 @@ </div> {% endif %} - {% if item.seizure_name or item.official_report_number or item.name_of_the_protagonist %} + {% if item.seizure_name or item.official_report_number or item.name_of_the_protagonist or item.applicant_authority or item.minutes_writer %} <h3>{% trans "Court-ordered seizure"%}</h3> <div class="row"> {% field_flex "Seizure name" item.seizure_name %} {% field_flex "Official report number" item.official_report_number %} {% field_flex "Name of the protagonist" item.name_of_the_protagonist %} + {% field_flex "Applicant authority" item.applicant_authority %} + {% field_flex "Writer of the minutes" item.minutes_writer %} </div> {% endif %} diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 8708d90bd..2bd4afef1 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -217,21 +217,22 @@ class UtilsTest(TestCase): self.assertEqual(res, expected) def test_tinyfy_url(self): - base_url = "https://example.com" - tiny_url = models.TinyUrl() - tiny_url.link = base_url - tiny_url.save() - - short_id = tiny_url.get_short_id() - db_id = models.TinyUrl.decode_id(short_id) - self.assertEqual(tiny_url.pk, db_id) - - ty = models.TinyUrl.objects.get(id=db_id) - self.assertEqual(base_url, ty.link) - c = Client() - response = c.get(reverse('tiny-redirect', args=[short_id])) - self.assertEqual(response['Location'], base_url) - self.assertEqual(response.status_code, 302) + for idx in range(65): # > 62 to test with 2 letters + base_url = "https://example.com#{}".format(idx) + tiny_url = models.TinyUrl() + tiny_url.link = base_url + tiny_url.save() + + short_id = tiny_url.get_short_id() + db_id = models.TinyUrl.decode_id(short_id) + self.assertEqual(tiny_url.pk, db_id) + + ty = models.TinyUrl.objects.get(id=db_id) + self.assertEqual(base_url, ty.link) + c = Client() + response = c.get(reverse('tiny-redirect', args=[short_id])) + self.assertEqual(response['Location'], base_url) + self.assertEqual(response.status_code, 302) class CommandsTestCase(TestCase): |