From: Magnus Hagander Date: Mon, 2 Jul 2018 11:31:20 +0000 (+0200) Subject: Stop crashing on forms with no selectize fields X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=4934977018ffb22b9dc1ae92fde84c9174bc6b39;p=pgeu-website.git Stop crashing on forms with no selectize fields --- diff --git a/postgresqleu/confreg/backendforms.py b/postgresqleu/confreg/backendforms.py index 3597a3e..41c5d63 100644 --- a/postgresqleu/confreg/backendforms.py +++ b/postgresqleu/confreg/backendforms.py @@ -105,6 +105,9 @@ class BackendForm(ConcurrentProtectedModelForm): self.fields[field].widget.attrs['readonly'] = 'true' def fix_selectize_fields(self, **kwargs): + if not self.selectize_multiple_fields: + return + for field, lookup in self.selectize_multiple_fields.items(): # If this is a postback of a selectize field, it may contain ids that are not currently # stored in the field. They must still be among the *allowed* values of course, which