Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
('display_tags', models.BooleanField(default=True, verbose_name='Display tags')),
('display_popular_entries', models.BooleanField(default=True, verbose_name='Display popular entries')),
('display_last_entries', models.BooleanField(default=True, verbose_name='Display last entries')),
('display_archive', models.BooleanField(default=True, verbose_name='Display archive')),
('disqus_api_secret', models.TextField(blank=True)),
('disqus_shortname', models.CharField(max_length=128, blank=True)),
('num_entries_page', models.IntegerField(default=5, verbose_name='Entries per page')),
('num_last_entries', models.IntegerField(default=3, verbose_name='Last entries limit')),
('num_popular_entries', models.IntegerField(default=3, verbose_name='Popular entries limit')),
('num_tags_entry_header', models.IntegerField(default=5, verbose_name='Tags limit entry header')),
('header_image', models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, verbose_name='Header image', blank=True, to='wagtailimages.Image', null=True)),
],
options={
'verbose_name': 'Blog',
},
bases=(puput.routes.BlogRoutes, 'wagtailcore.page'),
),
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(unique=True, max_length=80, verbose_name='Category Name')),
('slug', models.SlugField(unique=True, max_length=80)),
('description', models.CharField(max_length=500, blank=True)),
('parent', models.ForeignKey(related_name='children', blank=True, to='puput.Category', null=True, on_delete=models.SET_NULL)),
],
options={
'ordering': ['name'],
'verbose_name': 'Category',
'verbose_name_plural': 'Categories',
},
bases=(models.Model,),
("num_popular_entries", models.IntegerField(default=3, verbose_name="Popular entries limit")),
("num_tags_entry_header", models.IntegerField(default=5, verbose_name="Tags limit entry header")),
(
"header_image",
models.ForeignKey(
related_name="+",
on_delete=django.db.models.deletion.SET_NULL,
verbose_name="Header image",
blank=True,
to="wagtailimages.Image",
null=True,
),
),
],
options={"verbose_name": "Blog"},
bases=(puput.routes.BlogRoutes, "wagtailcore.page"),
),
migrations.CreateModel(
name="Category",
fields=[
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("name", models.CharField(unique=True, max_length=80, verbose_name="Category Name")),
("slug", models.SlugField(unique=True, max_length=80)),
("description", models.CharField(max_length=500, blank=True)),
(
"parent",
models.ForeignKey(
related_name="children", blank=True, to="puput.Category", null=True, on_delete=models.SET_NULL
),
),
],
options={"ordering": ["name"], "verbose_name": "Category", "verbose_name_plural": "Categories"},
from wagtail.snippets.models import register_snippet
from wagtail.search import index
from taggit.models import TaggedItemBase, Tag as TaggitTag
from modelcluster.fields import ParentalKey
from colorful.fields import RGBColorField
from .abstracts import EntryAbstract
from .utils import import_model, get_image_model_path
from .routes import BlogRoutes
from .managers import TagManager, CategoryManager, BlogManager
Entry = import_model(getattr(settings, 'PUPUT_ENTRY_MODEL', EntryAbstract))
class BlogPage(BlogRoutes, Page):
description = models.CharField(
verbose_name=_('Description'),
max_length=255,
blank=True,
help_text=_("The blog description that will appear under the title.")
)
header_image = models.ForeignKey(
get_image_model_path(),
verbose_name=_('Header image'),
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
main_color = RGBColorField(_('Blog Main Color'), default="#4D6AE0")