summaryrefslogtreecommitdiff
path: root/chimere/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'chimere/models.py')
-rw-r--r--chimere/models.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/chimere/models.py b/chimere/models.py
index 8be874c..b5f03cc 100644
--- a/chimere/models.py
+++ b/chimere/models.py
@@ -193,6 +193,7 @@ class Category(models.Model):
ordering = ["order"]
verbose_name = _(u"Category")
+
class Icon(models.Model):
'''Icon
'''
@@ -201,11 +202,16 @@ class Icon(models.Model):
height_field='height', width_field='width')
height = models.IntegerField(_(u"Height"))
width = models.IntegerField(_(u"Width"))
+ offset_x = models.IntegerField(_(u"Offset x"), default=10)
+ offset_y = models.IntegerField(_(u"Offset y"), default=25)
+
def __unicode__(self):
return self.name
+
class Meta:
verbose_name = _(u"Icon")
+
class SubCategory(models.Model):
'''Sub-category
'''
@@ -285,15 +291,17 @@ class SubCategory(models.Model):
return cats
def getJSONDict(self):
- items = {'id':self.pk, 'name':self.name,
- 'description':self.description if self.description\
- else '',
- 'icon':{'url':self.icon.image.url,
- 'width':self.icon.image.width,
- 'height':self.icon.image.height}
- }
+ items = {'id': self.pk, 'name': self.name,
+ 'description': self.description if self.description
+ else '',
+ 'icon': {'url': self.icon.image.url,
+ 'width': self.icon.image.width,
+ 'height': self.icon.image.height,
+ 'offset_x': self.icon.offset_x,
+ 'offset_y': self.icon.offset_y}}
+
if self.hover_icon:
- items['icon_hover'] = {'url':self.hover_icon.image.url}
+ items['icon_hover'] = {'url': self.hover_icon.image.url}
return items
def getJSON(self, categories_id=[]):