Skip to content

Instantly share code, notes, and snippets.

@littlepea
Last active December 16, 2015 10:09
Show Gist options
  • Save littlepea/5418003 to your computer and use it in GitHub Desktop.
Save littlepea/5418003 to your computer and use it in GitHub Desktop.
class Post(models.Model):
link = models.URLField(blank=True, null=True, db_index=True) # link is also unique identifier for each entry
updated = models.DateTimeField(blank=True, null=True, db_index=True) # last updated
published = models.DateTimeField(blank=True, null=True, db_index=True) #pubDate
title = models.CharField(max_length=250, blank=True, null=True) #short title, text without HTML
description = models.TextField(blank=True, null=True) #universal text/html representation of entry
class GoscaleCMSPlugin(CMSPlugin):
"""
Common base abstract class for all the GoScale plugins
"""
posts = models.ManyToManyField(Post, verbose_name=_('Posts'))
template = models.CharField(max_length=255, null=True, blank=True, verbose_name=_('Template'))
title = models.CharField(max_length=255, null=True, blank=True, verbose_name=_('Title'))
updated = models.DateTimeField(blank=True, null=True, db_index=True, verbose_name=_('Last updated'))
class Meta:
abstract = True
def copy_relations(self, oldinstance):
self.posts = oldinstance.posts.all()
class GooglePresentation(base_models.GoscaleCMSPlugin):
embed = models.TextField(verbose_name=_('Embed code'), help_text=_('From the "</> Embed" link.'))
width = models.SmallIntegerField(null=True, blank=True, verbose_name=_('Width'),
help_text=_('Width of a presentation container.'))
height = models.SmallIntegerField(null=True, blank=True, verbose_name=_('Height'),
help_text=_('Height of a presentation container.'))
ratio = models.CharField(max_length=50,
default=RATIO_CHOICES[0][0], choices=RATIO_CHOICES, verbose_name=_('Aspect ratio'),
help_text=_('Ratio of width:height used for the presentation if manual size isn\'t set.'))
embed_as_is = models.BooleanField(default=False, verbose_name=_('Embed "as is"'),
help_text=_('If set embed code will not be changed.'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment