gallery helper

This commit is contained in:
j 2017-12-19 11:54:06 +01:00
parent 8e85694895
commit 51aae2ec53

View File

@ -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'