diff options
Diffstat (limited to 'chimere/models.py')
| -rw-r--r-- | chimere/models.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/chimere/models.py b/chimere/models.py index dabe9fd..8e8fc0f 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -214,6 +214,7 @@ class SubCategory(models.Model): ('R', _(u'Route')), ('B', _(u'Both')),) item_type = models.CharField(_(u"Item type"), max_length=1, choices=TYPE) + description = models.TextField(blank=True, null=True) def __unicode__(self): return u"%s / %s" % (self.category.name, self.name) class Meta: @@ -259,6 +260,16 @@ class SubCategory(models.Model): [(subcat.pk, subcat.name) for subcat in subcats])) return cats + def getJSON(self, categories_id=[]): + '''Return a JSON string - mainly used to get description + ''' + items = {'id':self.pk, 'name':json.dumps(self.name), + 'description':json.dumps(self.description) if self.description\ + else ''} + json_string = u'{"pk": %(id)d, "name": %(name)s, '\ + u'"description":"%(description)s"}' % items + return json_string + IMPORTERS = {'KML':KMLManager, 'OSM':OSMManager, 'SHP':ShapefileManager @@ -615,7 +626,6 @@ def multimediafile_post_save(sender, **kwargs): multimediafile.save() post_save.connect(multimediafile_post_save, sender=MultimediaFile) - class PictureFile(models.Model): name = models.CharField(_(u"Name"), max_length=150) picture = models.ImageField(_(u"Image"), upload_to='pictures', @@ -647,7 +657,6 @@ def scale_image(max_x, pair): new_y = (float(max_x) / x) * y return (int(max_x), int(new_y)) - IMAGE_EXIF_ORIENTATION_MAP = { 1: 0, 8: 2, |
