add Topik object, wrapper around Page
[django-panik-combo.git] / panikombo / models.py
index 4a6ab48..4f9baeb 100644 (file)
@@ -1,4 +1,5 @@
 from datetime import date
+import os
 
 from django import template
 from django.db import models
@@ -137,3 +138,17 @@ class NewsItemAutoSelectionCell(CellBase):
         if self.title:
             return self.title
         return ''
+
+
+def get_topik_image_path(instance, filename):
+    return os.path.join('images', 'topik', instance.page.slug,
+            os.path.basename(filename))
+
+class Topik(models.Model):
+    page = models.ForeignKey('data.Page')
+    image = models.ImageField(_('Image'),
+            upload_to=get_topik_image_path, max_length=250, null=True, blank=True)
+
+    # denormalized from Focus
+    got_focus = models.DateTimeField(default=None, null=True, blank=True)
+    has_focus = models.BooleanField(default=False)