X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/54d2f3a9f5501bfca8ab48544123f2851c6c4085..63519710f7ae064e26d3ee068d59201e8bc02cf3:/apps/catalogue/models/image.py?ds=inline diff --git a/apps/catalogue/models/image.py b/apps/catalogue/models/image.py index 558f4c1f..fffa4b38 100755 --- a/apps/catalogue/models/image.py +++ b/apps/catalogue/models/image.py @@ -9,6 +9,7 @@ from django.db import models from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ from catalogue.helpers import cached_in_field +from catalogue.models import Project from catalogue.tasks import refresh_instance from dvcs import models as dvcs_models @@ -21,6 +22,7 @@ class Image(dvcs_models.Document): title = models.CharField(_('title'), max_length=255, blank=True) slug = models.SlugField(_('slug'), unique=True) public = models.BooleanField(_('public'), default=True, db_index=True) + project = models.ForeignKey(Project, null=True, blank=True) # cache _short_html = models.TextField(null=True, blank=True, editable=False) @@ -87,6 +89,14 @@ class Image(dvcs_models.Document): assert picture.picture_info.about == valid_about, \ _("rdf:about is not") + " " + valid_about + def publishable_error(self): + try: + return self.assert_publishable() + except AssertionError, e: + return e + else: + return None + def accessible(self, request): return self.public or request.user.is_authenticated()