+class PictureArea(models.Model):
+ picture = models.ForeignKey('picture.Picture', related_name='areas')
+ area = jsonfield.JSONField(_('area'), default={}, editable=False)
+ kind = models.CharField(_('kind'), max_length=10, blank=False,
+ null=False, db_index=True,
+ choices=(('thing', _('thing')),
+ ('theme', _('theme'))))
+
+ objects = models.Manager()
+ tagged = managers.ModelTaggedItemManager(catalogue.models.Tag)
+ tags = managers.TagDescriptor(catalogue.models.Tag)
+ tag_relations = GenericRelation(catalogue.models.Tag.intermediary_table_model)
+
+ short_html_url_name = 'picture_area_short'
+
+ @classmethod
+ def rectangle(cls, picture, kind, coords):
+ pa = PictureArea()
+ pa.picture = picture
+ pa.kind = kind
+ pa.area = coords
+ return pa
+
+ def flush_includes(self, languages=True):
+ if not languages:
+ return
+ if languages is True:
+ languages = [lc for (lc, _ln) in settings.LANGUAGES]
+ flush_ssi_includes([
+ template % (self.pk, lang)
+ for template in [
+ '/katalog/pa/%d/short.%s.html',
+ ]
+ for lang in languages
+ ])
+
+