--- /dev/null
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import ckeditor.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('auth', '0001_initial'),
+ ('data', '0009_auto_20150529_2247'),
+ ('panikombo', '0007_newsitemautoselectioncell_category'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='TopikCell',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('placeholder', models.CharField(max_length=20)),
+ ('order', models.PositiveIntegerField()),
+ ('slug', models.SlugField(verbose_name='Slug', blank=True)),
+ ('public', models.BooleanField(default=True, verbose_name='Public')),
+ ('text', ckeditor.fields.RichTextField(null=True, verbose_name='Text', blank=True)),
+ ('groups', models.ManyToManyField(to='auth.Group', verbose_name='Groups', blank=True)),
+ ('page', models.ForeignKey(to='data.Page')),
+ ('topik', models.ForeignKey(to='panikombo.Topik', null=True)),
+ ],
+ options={
+ 'verbose_name': 'Topik',
+ },
+ bases=(models.Model,),
+ ),
+ ]
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