from django.db import models
from django.utils.translation import ugettext_lazy as _
+from ckeditor.fields import RichTextField
from taggit.managers import TaggableManager
from combo.data.models import CellBase
got_focus = models.DateTimeField(default=None, null=True, blank=True)
has_focus = models.BooleanField(default=False)
+ def __unicode__(self):
+ if not self.page:
+ return super(Topik, self).__unicode__()
+ return unicode(self.page)
+
class ItemTopik(models.Model):
newsitem = models.ForeignKey('emissions.NewsItem', verbose_name=_('News Item'),
null=True, blank=True)
topik = models.ForeignKey('Topik', verbose_name='Topik',
null=True, blank=True)
+
+
+@register_cell_class
+class TopikCell(CellBase):
+ topik = models.ForeignKey(Topik, null=True)
+ text = RichTextField(_('Text'), blank=True, null=True)
+
+ template_name = 'panikombo/topik-cell.html'
+
+ class Meta:
+ verbose_name = _('Topik')
+
+ def get_additional_label(self):
+ if not self.topik:
+ return ''
+ return self.topik.page.title