summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-02-16 15:48:07 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-02-16 15:48:07 +0100
commit0636972bf32617eba4fd9f889eb54e23d0e1c743 (patch)
tree8b6d7464ec99ba333adf98f96905d53a7ed203b5
parentd5a263fb9fb15c591f5b1e08ad800582fe1ea707 (diff)
downloadIshtar-0636972bf32617eba4fd9f889eb54e23d0e1c743.tar.bz2
Ishtar-0636972bf32617eba4fd9f889eb54e23d0e1c743.zip
Wizard: get formated data with new Django API for Options
-rw-r--r--ishtar_common/wizards.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index 114b47712..cffaac271 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -1253,19 +1253,24 @@ class DeletionWizard(Wizard):
if not self.current_obj:
return datas
res = {}
- for field in self.model._meta.fields + self.model._meta.many_to_many:
+ for field in self.model._meta.get_fields():
if field.name not in self.fields:
continue
value = getattr(self.current_obj, field.name)
if not value:
continue
+ label = ""
+ if hasattr(field, 'verbose_name'):
+ label = field.verbose_name
if hasattr(value, 'all'):
+ if not label and hasattr(field, 'related_model'):
+ label = field.related_model._meta.verbose_name_plural
value = ", ".join([unicode(item) for item in value.all()])
if not value:
continue
else:
value = unicode(value)
- res[field.name] = (field.verbose_name, value, '')
+ res[field.name] = (label, value, '')
if not datas and self.fields:
datas = [['', []]]
for field in self.fields: