Person: uprava editace, Moznost nevyplnit PSC

This commit is contained in:
Martin Rejman 2019-04-12 01:09:47 +02:00
parent e1165f31cf
commit 94bcf44c96
2 changed files with 3 additions and 1 deletions

View File

@ -150,7 +150,7 @@ class AppUser(AbstractUser, DataAudited):
##
# User self-editable fields
##
postcode = IntegerField(_('PSČ'), blank=False, null=True)
postcode = IntegerField(_('PSČ'), blank=True, 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

@ -303,10 +303,12 @@ def person_edit(request, id):
if request.method == "GET":
form = _form(instance=obj)
form.fields['email_contact'].disabled = True
elif request.method == "POST":
with obj.audit_context(request.user) as ac:
form = _form(request.POST, instance=obj)
form.fields['email_contact'].disabled = True
if form.is_valid():
form.save()