People: editace PSC KoDo vc. moznosti None; Oprava records_audit

This commit is contained in:
Martin Rejman 2019-04-12 01:13:23 +02:00
parent 94bcf44c96
commit 7f110a3aa7
4 changed files with 22 additions and 2 deletions

View File

@ -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,

View File

@ -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()

View File

@ -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'),
),
]

View File

@ -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.