Features: store titles as a JSONField and add loadmap and dumpmap support

This commit is contained in:
Laura Klünder 2016-09-26 11:18:56 +02:00
parent 49c2270b84
commit be62b14669
11 changed files with 101 additions and 27 deletions

View file

@ -21,13 +21,11 @@ def add_feature(request, feature_type):
with transaction.atomic():
feature = form.instance
feature.feature_type = feature_type.name
feature.save()
feature.titles = {}
for language, title in form.titles.items():
if title:
feature.featuretitles.update_or_create(language=language, defaults={'title': title})
else:
feature.featuretitles.filter(language=language).delete()
feature.titles[language] = title
feature.save()
return render(request, 'editor/feature_success.html', {})
else: