From 7f110a3aa7f7e6e2b5b598ca07e3b84a791078e7 Mon Sep 17 00:00:00 2001 From: Martin Rejman Date: Fri, 12 Apr 2019 01:13:23 +0200 Subject: [PATCH] People: editace PSC KoDo vc. moznosti None; Oprava records_audit --- src/nalodeni/models.py | 2 +- src/nalodeni/people.py | 2 ++ .../migrations/0004_auto_20190412_0112.py | 18 ++++++++++++++++++ src/records_audit/models.py | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 src/records_audit/migrations/0004_auto_20190412_0112.py diff --git a/src/nalodeni/models.py b/src/nalodeni/models.py index 0d4aebb..a453e7a 100644 --- a/src/nalodeni/models.py +++ b/src/nalodeni/models.py @@ -150,7 +150,7 @@ class AppUser(AbstractUser, DataAudited): ## # User self-editable fields ## - postcode = IntegerField(_('PSČ'), blank=True, null=True) + postcode = IntegerField(_('PSČ'), blank=False, null=True) city = CharField(_(u'Město'), max_length=120, default=None, blank=True, null=True) district = IntegerField(_('Kraj'), blank=True, null=True, diff --git a/src/nalodeni/people.py b/src/nalodeni/people.py index ae5750c..85c2b9b 100644 --- a/src/nalodeni/people.py +++ b/src/nalodeni/people.py @@ -304,11 +304,13 @@ def person_edit(request, id): if request.method == "GET": form = _form(instance=obj) form.fields['email_contact'].disabled = True + form.fields['postcode'].required = False elif request.method == "POST": with obj.audit_context(request.user) as ac: form = _form(request.POST, instance=obj) form.fields['email_contact'].disabled = True + form.fields['postcode'].required = False if form.is_valid(): form.save() diff --git a/src/records_audit/migrations/0004_auto_20190412_0112.py b/src/records_audit/migrations/0004_auto_20190412_0112.py new file mode 100644 index 0000000..b359519 --- /dev/null +++ b/src/records_audit/migrations/0004_auto_20190412_0112.py @@ -0,0 +1,18 @@ +# Generated by Django 2.0.3 on 2019-04-12 01:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('records_audit', '0003_auto_20190411_2010'), + ] + + operations = [ + migrations.AlterField( + model_name='auditlog', + name='val', + field=models.CharField(max_length=500, null=True, verbose_name='Field value'), + ), + ] diff --git a/src/records_audit/models.py b/src/records_audit/models.py index 1c4e60b..f440baf 100644 --- a/src/records_audit/models.py +++ b/src/records_audit/models.py @@ -53,7 +53,7 @@ class AuditLog(models.Model): rid = models.IntegerField(_('Table record ID'), null=False, editable=False) - val = models.CharField(_('Field value'), max_length=500) + val = models.CharField(_('Field value'), max_length=500, null=True) """ The latest value is stored in the actual model table. This value is the previous one.