From 03715cba601c571ac35765daa5b6a97a004326cf Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 8 Aug 2019 17:09:29 +0200 Subject: [PATCH 1/1] fixes --- src/catalogue/forms.py | 2 +- src/picture/models.py | 3 +++ src/sponsors/models.py | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/catalogue/forms.py b/src/catalogue/forms.py index 53d69c15f..405ea7c48 100644 --- a/src/catalogue/forms.py +++ b/src/catalogue/forms.py @@ -76,7 +76,7 @@ class CustomPDFForm(forms.Form): for name, label in CUSTOMIZATION_FLAGS: self.fields[name] = forms.BooleanField(required=False, label=label) for name, label, choices in CUSTOMIZATION_OPTIONS: - self.fields[name] = forms.ChoiceField(choices, required=False, label=label) + self.fields[name] = forms.ChoiceField(choices=choices, required=False, label=label) def clean(self): self.cleaned_data['cust'] = self.customizations diff --git a/src/picture/models.py b/src/picture/models.py index 875ebcc9c..3a05ad8dc 100644 --- a/src/picture/models.py +++ b/src/picture/models.py @@ -110,6 +110,9 @@ class Picture(models.Model): verbose_name = _('picture') verbose_name_plural = _('pictures') + def get_extra_info_json(self): + return json.loads(self.extra_info or '{}') + def save(self, force_insert=False, force_update=False, **kwargs): from sortify import sortify diff --git a/src/sponsors/models.py b/src/sponsors/models.py index 6e4ffe1f3..905631394 100644 --- a/src/sponsors/models.py +++ b/src/sponsors/models.py @@ -53,7 +53,8 @@ class SponsorPage(models.Model): offset -= THUMB_HEIGHT except KeyError: pass - result.append(result_group) + if result_group['sponsors']: + result.append(result_group) return result def render_sprite(self): @@ -95,7 +96,7 @@ class SponsorPage(models.Model): 'page': self }) ret = super(SponsorPage, self).save(*args, **kwargs) - cache.delete('sponsor_page:' + name) + cache.delete('sponsor_page:' + self.name) return ret def __str__(self): -- 2.20.1