summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
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
commit9ead7a5ac3fc8b83b95f8ed4558d92809f19805f (patch)
tree8b6d7464ec99ba333adf98f96905d53a7ed203b5 /ishtar_common/wizards.py
parent36db82b63295ef2bec9b01c934ee0ad76bdc13b8 (diff)
downloadIshtar-9ead7a5ac3fc8b83b95f8ed4558d92809f19805f.tar.bz2
Ishtar-9ead7a5ac3fc8b83b95f8ed4558d92809f19805f.zip
Wizard: get formated data with new Django API for Options
Diffstat (limited to 'ishtar_common/wizards.py')
-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: