summaryrefslogtreecommitdiff
path: root/chimere/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-09-14 20:32:08 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-09-14 20:32:08 +0200
commitf2a7d925feeaa8d3a27d61b0fb9fcacca7ca3837 (patch)
tree5e4416d9e100db2dad378051c1a14013b65d2b5b /chimere/forms.py
parente57a53facf1586f855195f8cce75559aef8e50f1 (diff)
downloadChimère-f2a7d925feeaa8d3a27d61b0fb9fcacca7ca3837.tar.bz2
Chimère-f2a7d925feeaa8d3a27d61b0fb9fcacca7ca3837.zip
Route are now managed like Markers (database and python)
Diffstat (limited to 'chimere/forms.py')
-rw-r--r--chimere/forms.py19
1 files changed, 1 insertions, 18 deletions
diff --git a/chimere/forms.py b/chimere/forms.py
index 8b86df1..0187564 100644
--- a/chimere/forms.py
+++ b/chimere/forms.py
@@ -559,32 +559,15 @@ class RouteForm(RouteAdminForm):
def save(self, *args, **keys):
"""
- Custom save method in order to manage associated marker and file
+ Custom save method in order to manage associated file
"""
new_route = super(RouteForm, self).save(*args, **keys)
- if new_route.status == 'S':
- new_route.has_associated_marker = True
- new_route.save()
# associate a route file
if 'associated_file_id' in self.cleaned_data and \
self.cleaned_data['associated_file_id']:
file_pk = int(self.cleaned_data['associated_file_id'])
new_route.associated_file = RouteFile.objects.get(pk=file_pk)
new_route.save()
- # change the associated marker (if available)
- q_new_marker = Marker.objects.filter(route=new_route)
- if not q_new_marker.count():
- return new_route
- new_marker = q_new_marker.all()[0]
- # save description
- if self.cleaned_data['description']:
- new_marker.description = self.cleaned_data['description']
- new_marker.save()
- # save properties
- properties = dict(
- [(k.split('_')[-1], self.cleaned_data[k])
- for k in self.cleaned_data.keys() if k.startswith('property_')])
- new_marker.saveProperties(properties)
return new_route