Skip to content

Instantly share code, notes, and snippets.

@spenoir
Created August 15, 2012 08:06
Show Gist options
  • Save spenoir/3357540 to your computer and use it in GitHub Desktop.
Save spenoir/3357540 to your computer and use it in GitHub Desktop.
just a Content model example
class ContentImage(models.Model):
"""
An Image that is specific to Content
"""
content = models.ForeignKey('ContentModel', related_name='images')
# credit = models.CharField(max_length=200, blank=True)
# caption = models.TextField(blank=True)
image = models.ImageField(upload_to=settings.UPLOAD_PATH_CONTENTS_MEDIA)
position = models.CharField(max_length=8, choices=CONTENTS_MEDIA_POSITIONS, blank=True, null=True)
class ContentModel(SuperModel):
title = models.CharField(max_length=255)
slug = models.SlugField()
intro = models.TextField(blank=True, null=True)
intro_image = models.ImageField(upload_to=settings.UPLOAD_PATH_CONTENTS_MEDIA, blank=True, null=True)
content = models.TextField(blank=True, null=True)
video = models.CharField(max_length=255, blank=True, null=True)
video_position = models.CharField(max_length=8, choices=CONTENTS_MEDIA_POSITIONS, blank=True, null=True)
date_published = models.DateTimeField()
class Meta:
abstract = True
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment