fixes
authorRadek Czajka <rczajka@rczajka.pl>
Thu, 8 Aug 2019 15:09:29 +0000 (17:09 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Thu, 8 Aug 2019 15:09:29 +0000 (17:09 +0200)
src/catalogue/forms.py
src/picture/models.py
src/sponsors/models.py

index 53d69c1..405ea7c 100644 (file)
@@ -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:
         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
 
     def clean(self):
         self.cleaned_data['cust'] = self.customizations
index 875ebcc..3a05ad8 100644 (file)
@@ -110,6 +110,9 @@ class Picture(models.Model):
         verbose_name = _('picture')
         verbose_name_plural = _('pictures')
 
         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
 
     def save(self, force_insert=False, force_update=False, **kwargs):
         from sortify import sortify
 
index 6e4ffe1..9056313 100644 (file)
@@ -53,7 +53,8 @@ class SponsorPage(models.Model):
                     offset -= THUMB_HEIGHT
                 except KeyError:
                     pass
                     offset -= THUMB_HEIGHT
                 except KeyError:
                     pass
-            result.append(result_group)
+            if result_group['sponsors']:
+                result.append(result_group)
         return result
 
     def render_sprite(self):
         return result
 
     def render_sprite(self):
@@ -95,7 +96,7 @@ class SponsorPage(models.Model):
             'page': self
         })
         ret = super(SponsorPage, self).save(*args, **kwargs)
             '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):
         return ret
 
     def __str__(self):