Created
February 28, 2013 14:25
-
-
Save yml/5057097 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from picocms.models import CMSModel, CMSCategory, ActiveModelManager | |
from picocms import fields | |
ARTICLES_ROOT = 'Publications' | |
class Article(CMSModel): | |
""" Defines an article for the CMS """ | |
date_display = models.DateTimeField(default=datetime.datetime.now()) #: | |
highlight = models.BooleanField(default=False, verbose_name=u'Highlight') #: | |
source = fields.HTMLField(null=True, blank=True) #: | |
authors = fields.HTMLField(null=True, blank=True) #: | |
introduction = fields.HTMLField(null=True, blank=True) #: | |
contents = fields.HTMLBigField() #: | |
more_info = fields.HTMLField(null=True, blank=True) #: | |
related_articles = models.ManyToManyField('self', null=True, blank=True) #: | |
related_terms = models.ManyToManyField('Term', null=True, blank=True) #: | |
related_files = models.ManyToManyField('File', null=True, blank=True, related_name='articles') #: | |
related_links = models.ManyToManyField('Link', null=True, blank=True, related_name='links') #: | |
objects = ActiveModelManager() | |
class Meta: | |
ordering = ['-pk'] | |
class CMSMeta: | |
image_model = File | |
root_category = ARTICLES_ROOT | |
class File(CMSModel): | |
""" Defines an uploaded file for the CMS """ | |
description = fields.HTMLField(null=True, blank=True) #: | |
file = models.FileField(upload_to='files/%Y/%m/%d') #: Local path to the file, relative to settings.MEDIA_ROOT | |
class Meta: | |
ordering = ['-pk'] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment