Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Post(models.Model):
- title = models.CharField(max_length=200)
- slug = models.CharField(max_length=200)
- class ItemBase(models.Model):
- #post = models.ManyToManyField('Post', related_name='%(class)s_related')
- title = models.CharField(max_length=250)
- class Meta:
- abstract = True
- def render(self):
- return render_to_string('content/items/{}.html'.format(self._meta.model_name), {'item': self})
- class Image(ItemBase):
- image_url = models.URLField(blank=True, null=True)
- image_file = models.ImageField(upload_to='posts/%Y/%m/%d',
- blank=True, null=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement