summaryrefslogtreecommitdiff
path: root/chimere/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2012-03-07 15:19:19 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2012-03-07 15:19:19 +0100
commit9d32b35a7b5f4effa1551c67bde8cef733a151d4 (patch)
tree1581fb2a0a70975186ae852e959efe6419234450 /chimere/models.py
parent7f5a997212159172fe5ed3fb17a56b0c4fbdafa4 (diff)
downloadChimère-9d32b35a7b5f4effa1551c67bde8cef733a151d4.tar.bz2
Chimère-9d32b35a7b5f4effa1551c67bde8cef733a151d4.zip
Deport the "iframe status" to multimedia types
Diffstat (limited to 'chimere/models.py')
-rw-r--r--chimere/models.py31
1 files changed, 28 insertions, 3 deletions
diff --git a/chimere/models.py b/chimere/models.py
index 52b13f4..1933ba3 100644
--- a/chimere/models.py
+++ b/chimere/models.py
@@ -237,6 +237,16 @@ class Marker(GeographicItem):
def __unicode__(self):
return self.name
+ def get_init_multi(self):
+ multis = [forms.model_to_dict(multi)
+ for multi in self.multimedia_files.all()]
+ return multis
+
+ def get_init_picture(self):
+ picts = [forms.model_to_dict(pict)
+ for pict in self.pictures.all()]
+ return picts
+
@property
def multimedia_items(self):
pict = list(self.pictures.filter(miniature=False).all())
@@ -350,12 +360,14 @@ class Marker(GeographicItem):
class MultimediaType(models.Model):
MEDIA_TYPES = (('A', _(u"Audio")),
('V', _(u"Video")),
- ('I', _(u"Image")))
+ ('I', _(u"Image")),
+ ('O', _(u"Other")),)
media_type = models.CharField(_(u"Media type"), max_length=1,
choices=MEDIA_TYPES)
name = models.CharField(_(u"Name"), max_length=150)
mime_type = models.CharField(_(u"Mime type"), max_length=50, blank=True,
null=True)
+ iframe = models.BooleanField(u"Inside an iframe", default=False)
available = models.BooleanField(_(u"Available"), default=True)
def __unicode__(self):
@@ -364,7 +376,6 @@ class MultimediaType(models.Model):
class MultimediaFile(models.Model):
name = models.CharField(_(u"Name"), max_length=150, blank=True, null=True)
url = models.CharField(_(u"Url"), max_length=200)
- iframe = models.BooleanField(u"Iframe", default=False)
order = models.IntegerField(_(u"Order"), default=1)
multimedia_type = models.ForeignKey(MultimediaType, blank=True,
null=True)
@@ -381,12 +392,12 @@ class MultimediaFile(models.Model):
u"to an iframe."))
class PictureFile(models.Model):
- miniature = models.BooleanField(_(u"Miniature"))
name = models.CharField(_(u"Name"), max_length=150, blank=True, null=True)
picture = models.ImageField(_(u"Image"), upload_to='upload',
height_field='height', width_field='width')
height = models.IntegerField(_(u"Height"))
width = models.IntegerField(_(u"Width"))
+ miniature = models.BooleanField(_(u"Display inside the resume ?"))
order = models.IntegerField(_(u"Order"), default=1)
def __unicode__(self):
@@ -469,6 +480,20 @@ class Route(GeographicItem):
ordering = ('status', 'name')
verbose_name = _(u"Route")
+ def get_init_multi(self):
+ if not self.associated_file:
+ return []
+ multis = [forms.model_to_dict(multi)
+ for multi in self.associated_file.multimedia_files.all()]
+ return multis
+
+ def get_init_picture(self):
+ if not self.associated_file:
+ return []
+ picts = [forms.model_to_dict(pict)
+ for pict in self.associated_file.pictures.all()]
+ return picts
+
def getProperty(self, propertymodel, safe=None):
"""Get the property of an associated property model.
If safe set to True, verify if the property is available