From: Radek Czajka Date: Thu, 8 Aug 2019 15:09:29 +0000 (+0200) Subject: fixes X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/03715cba601c571ac35765daa5b6a97a004326cf?ds=inline;hp=7b36a6299b5e5e2c4e0705fa1b2965a97a76aadc fixes --- 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):