class Migration(migrations.Migration): dependencies = [ ('cmsplugin_zinnia', '0002_fix_djangocms330_incompatible_change'), ] operations = [ migrations.AlterField( model_name='latestentriesplugin', name='template_to_render', field=models.CharField( blank=False, choices=get_template_choices(), default=get_default_template(), help_text='template used to display the plugin', max_length=250, verbose_name='template'), ), migrations.AlterField( model_name='queryentriesplugin', name='template_to_render', field=models.CharField( blank=False, choices=get_template_choices(), default=get_default_template(), help_text='template used to display the plugin', max_length=250, verbose_name='template'), ), migrations.AlterField( model_name='randomentriesplugin', name='template_to_render', field=models.CharField( blank=False, choices=get_template_choices(), default=get_default_template(), help_text='template used to display the plugin', max_length=250, verbose_name='template'), ), migrations.AlterField( model_name='selectedentriesplugin', name='template_to_render', field=models.CharField( blank=False, choices=get_template_choices(), default=get_default_template(), help_text='template used to display the plugin', max_length=250, verbose_name='template'), ), ]
class SelectedEntriesPlugin(CMSPlugin): """ CMS Plugin for displaying custom entries """ entries = models.ManyToManyField('zinnia.Entry', verbose_name=_('entries')) template_to_render = models.CharField( _('template'), blank=True, max_length=250, choices=get_template_choices(), default=get_default_template(), help_text=_('template used to display the plugin')) @property def render_template(self): """ Override render_template to use the template_to_render attribute """ return self.template_to_render def copy_relations(self, old_instance): """ Duplicate ManyToMany relations on plugin copy """ self.entries.set(old_instance.entries.all()) def __str__(self): return _('%s entries') % self.entries.count()
class QueryEntriesPlugin(CMSPlugin): """ CMS Plugin for displaying entries based on a search pattern """ query = models.CharField( _('query'), max_length=250, help_text=_( 'You can use - to exclude words or phrases, "double ' 'quotes" for exact phrases and the AND/OR boolean ' 'operators combined with parenthesis for complex queries.')) number_of_entries = models.PositiveIntegerField( _('number of entries'), default=5, help_text=_('0 means all the entries')) template_to_render = models.CharField( _('template'), blank=True, max_length=250, choices=get_template_choices(), default=get_default_template(), help_text=_('template used to display the plugin')) @property def render_template(self): """ Override render_template to use the template_to_render attribute """ return self.template_to_render def __str__(self): return _('%s entries') % self.number_of_entries
class LatestEntriesPlugin(CMSPlugin): """ CMS Plugin for displaying latest entries """ featured = models.BooleanField(_('featured'), blank=True, null=True, choices=((True, _('Show featured entries only')), (False, _('Hide featured entries')))) categories = models.ManyToManyField('zinnia.Category', verbose_name=_('categories'), blank=True) subcategories = models.BooleanField( _('include subcategories'), default=True, help_text=_('include the entries belonging the subcategories')) authors = models.ManyToManyField('zinnia.Author', verbose_name=_('authors'), blank=True) tags = models.ManyToManyField('tagging.Tag', verbose_name=_('tags'), blank=True) number_of_entries = models.PositiveIntegerField( _('number of entries'), default=5, help_text=_('0 means all the entries')) offset = models.PositiveIntegerField( _('offset'), default=0, help_text=_('number of entries to skip from top of list')) template_to_render = models.CharField( _('template'), blank=False, max_length=250, choices=get_template_choices(), default=get_default_template(), help_text=_('template used to display the plugin')) @property def render_template(self): """ Override render_template to use the template_to_render attribute """ return self.template_to_render def copy_relations(self, old_instance): """ Duplicate ManyToMany relations on plugin copy """ self.tags.set(old_instance.tags.all()) self.authors.set(old_instance.authors.all()) self.categories.set(old_instance.categories.all()) def __str__(self): return _('%s entries') % self.number_of_entries
class RandomEntriesPlugin(CMSPlugin): """ CMS Plugin for displaying random entries """ number_of_entries = models.PositiveIntegerField(_('number of entries'), default=5) template_to_render = models.CharField( _('template'), blank=True, max_length=250, choices=get_template_choices(), default=get_default_template(), help_text=_('template used to display the plugin')) def __str__(self): return _('%s entries') % self.number_of_entries
class Migration(migrations.Migration): dependencies = [ ('cmsplugin_zinnia', '0001_initial'), ] operations = [ migrations.AlterField( model_name='calendarentriesplugin', name='cmsplugin_ptr', field=models.OneToOneField(related_name='cmsplugin_zinnia_calendarentriesplugin', primary_key=True, serialize=False, auto_created=True, to='cms.CMSPlugin', parent_link=True, on_delete=models.CASCADE), ), migrations.AlterField( model_name='latestentriesplugin', name='cmsplugin_ptr', field=models.OneToOneField(related_name='cmsplugin_zinnia_latestentriesplugin', primary_key=True, serialize=False, auto_created=True, to='cms.CMSPlugin', parent_link=True, on_delete=models.CASCADE), ), migrations.AlterField( model_name='latestentriesplugin', name='template_to_render', field=models.CharField(choices=get_template_choices(), blank=True, verbose_name='template', max_length=250, help_text='template used to display the plugin'), ), migrations.AlterField( model_name='queryentriesplugin', name='cmsplugin_ptr', field=models.OneToOneField(related_name='cmsplugin_zinnia_queryentriesplugin', primary_key=True, serialize=False, auto_created=True, to='cms.CMSPlugin', parent_link=True, on_delete=models.CASCADE), ), migrations.AlterField( model_name='queryentriesplugin', name='template_to_render', field=models.CharField(choices=get_template_choices(), blank=True, verbose_name='template', max_length=250, help_text='template used to display the plugin'), ), migrations.AlterField( model_name='randomentriesplugin', name='cmsplugin_ptr', field=models.OneToOneField(related_name='cmsplugin_zinnia_randomentriesplugin', primary_key=True, serialize=False, auto_created=True, to='cms.CMSPlugin', parent_link=True, on_delete=models.CASCADE), ), migrations.AlterField( model_name='randomentriesplugin', name='template_to_render', field=models.CharField(choices=get_template_choices(), blank=True, verbose_name='template', max_length=250, help_text='template used to display the plugin'), ), migrations.AlterField( model_name='selectedentriesplugin', name='cmsplugin_ptr', field=models.OneToOneField(related_name='cmsplugin_zinnia_selectedentriesplugin', primary_key=True, serialize=False, auto_created=True, to='cms.CMSPlugin', parent_link=True, on_delete=models.CASCADE), ), migrations.AlterField( model_name='selectedentriesplugin', name='template_to_render', field=models.CharField(choices=get_template_choices(), blank=True, verbose_name='template', max_length=250, help_text='template used to display the plugin'), ), ]
class Migration(migrations.Migration): dependencies = [ ('zinnia', '0001_initial'), ('cms', '__first__'), ('tagging', '__first__'), ] operations = [ migrations.CreateModel( name='CalendarEntriesPlugin', fields=[ ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('year', models.PositiveIntegerField(null=True, verbose_name='year', blank=True)), ('month', models.PositiveIntegerField(null=True, verbose_name='month', blank=True)), ], options={ 'abstract': False, }, bases=('cms.cmsplugin',), ), migrations.CreateModel( name='LatestEntriesPlugin', fields=[ ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('featured', models.NullBooleanField(verbose_name='featured', choices=[(True, 'Show featured entries only'), (False, 'Hide featured entries')])), ('subcategories', models.BooleanField(default=True, help_text='include the entries belonging the subcategories', verbose_name='include subcategories')), ('number_of_entries', models.PositiveIntegerField(default=5, help_text='0 means all the entries', verbose_name='number of entries')), ('offset', models.PositiveIntegerField(default=0, help_text='number of entries to skip from top of list', verbose_name='offset')), ('template_to_render', models.CharField(blank=True, help_text='template used to display the plugin', max_length=250, verbose_name='template', choices=get_template_choices())), ('authors', models.ManyToManyField(to='zinnia.Author', verbose_name='authors', blank=True)), ('categories', models.ManyToManyField(to='zinnia.Category', verbose_name='categories', blank=True)), ('tags', models.ManyToManyField(to='tagging.Tag', verbose_name='tags', blank=True)), ], options={ 'abstract': False, }, bases=('cms.cmsplugin',), ), migrations.CreateModel( name='QueryEntriesPlugin', fields=[ ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('query', models.CharField(help_text='You can use - to exclude words or phrases, "double quotes" for exact phrases and the AND/OR boolean operators combined with parenthesis for complex queries.', max_length=250, verbose_name='query')), ('number_of_entries', models.PositiveIntegerField(default=5, help_text='0 means all the entries', verbose_name='number of entries')), ('template_to_render', models.CharField(blank=True, help_text='template used to display the plugin', max_length=250, verbose_name='template', choices=get_template_choices())), ], options={ 'abstract': False, }, bases=('cms.cmsplugin',), ), migrations.CreateModel( name='RandomEntriesPlugin', fields=[ ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('number_of_entries', models.PositiveIntegerField(default=5, verbose_name='number of entries')), ('template_to_render', models.CharField(blank=True, help_text='template used to display the plugin', max_length=250, verbose_name='template', choices=get_template_choices())), ], options={ 'abstract': False, }, bases=('cms.cmsplugin',), ), migrations.CreateModel( name='SelectedEntriesPlugin', fields=[ ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('template_to_render', models.CharField(blank=True, help_text='template used to display the plugin', max_length=250, verbose_name='template', choices=get_template_choices())), ('entries', models.ManyToManyField(to='zinnia.Entry', verbose_name='entries')), ], options={ 'abstract': False, }, bases=('cms.cmsplugin',), ), ]