summaryrefslogtreecommitdiff
path: root/chimere/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'chimere/models.py')
-rw-r--r--chimere/models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/chimere/models.py b/chimere/models.py
index c053e1b..27875ec 100644
--- a/chimere/models.py
+++ b/chimere/models.py
@@ -25,6 +25,7 @@ import simplejson as json
from lxml import etree
from datetime import datetime, timedelta
from subprocess import Popen, PIPE
+import unidecode
from django.conf import settings
from django.contrib.gis.db import models
@@ -301,6 +302,15 @@ class Marker(GeographicItem):
def __unicode__(self):
return self.name
+ def __init__(self, *args, **kwargs):
+ super(Marker, self).__init__(*args, **kwargs)
+ # add read attributes for properties
+ for property in self.getProperties():
+ attr_name = unidecode.unidecode(property.propertymodel.name).lower()
+ attr_name = re.sub(r'\W+','_', attr_name.strip())
+ if not hasattr(self, attr_name):
+ setattr(self, attr_name, property.value)
+
def get_init_multi(self):
multis = [forms.model_to_dict(multi)
for multi in self.multimedia_files.all()]