gallery helper
This commit is contained in:
parent
8e85694895
commit
51aae2ec53
|
@ -6,6 +6,7 @@ from django.core.validators import MaxLengthValidator
|
|||
from django.db import models
|
||||
from django.utils.html import mark_safe
|
||||
|
||||
from photologue.models import Photo, Gallery
|
||||
from markdownx.models import MarkdownxField
|
||||
from markdownx.utils import markdownify
|
||||
import ox
|
||||
|
@ -140,6 +141,10 @@ class Content(models.Model):
|
|||
parts = [section, self.shortname]
|
||||
return '/' + '/'.join(parts)
|
||||
|
||||
def get_gallery(self):
|
||||
gallery, created = Gallery.objects.get_or_create(slug=self.shortname)
|
||||
return gallery
|
||||
|
||||
class Meta:
|
||||
managed = True
|
||||
db_table = 'content'
|
||||
|
|
Loading…
Reference in New Issue
Block a user