diff options
| author | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-07-02 01:31:53 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-07-02 01:31:53 +0200 | 
| commit | 5551911f6f2430688472494c745b39c398ddc903 (patch) | |
| tree | a2a4783a03c120df41bd4f45b207511039ec8cde /ishtar/ishtar_base/forms.py | |
| parent | 48827b3dbcd37a0e0655c4d3e17d77d6112d9f40 (diff) | |
| download | Ishtar-5551911f6f2430688472494c745b39c398ddc903.tar.bz2 Ishtar-5551911f6f2430688472494c745b39c398ddc903.zip  | |
Packaging of archaelogical items (closes #500)
Diffstat (limited to 'ishtar/ishtar_base/forms.py')
| -rw-r--r-- | ishtar/ishtar_base/forms.py | 24 | 
1 files changed, 18 insertions, 6 deletions
diff --git a/ishtar/ishtar_base/forms.py b/ishtar/ishtar_base/forms.py index 9faba2ac9..85c4371d4 100644 --- a/ishtar/ishtar_base/forms.py +++ b/ishtar/ishtar_base/forms.py @@ -191,6 +191,9 @@ class Wizard(NamedUrlSessionFormWizard):                          continue                      if hasattr(base_form, 'fields') and key in base_form.fields:                          lbl = base_form.fields[key].label +                        if hasattr(base_form, 'associated_labels') \ +                           and key in base_form.associated_labels: +                            lbl = base_form.associated_labels[key]                      if not lbl:                          continue                      value = cleaned_data[key] @@ -198,15 +201,24 @@ class Wizard(NamedUrlSessionFormWizard):                          continue                      if type(value) == bool:                          if value == True: -                            value = _("Yes") +                            value = _(u"Yes")                          elif value == False: -                            value = _("No") +                            value = _(u"No")                      elif key in associated_models: -                        item = associated_models[key].objects.get(pk=value) -                        if hasattr(item, 'short_label'): -                            value = item.short_label() +                        values = [] +                        if "," in unicode(value): +                            values = unicode(value).split(",")                          else: -                            value = unicode(item) +                            values = [value] +                        rendered_values = [] +                        for val in values: +                            item = associated_models[key].objects.get(pk=val) +                            if hasattr(item, 'short_label'): +                                value = item.short_label() +                            else: +                                value = unicode(item) +                            rendered_values.append(value) +                        value = u" ; ".join(rendered_values)                      form_datas.append((lbl, value, ''))              if form_datas:                  datas.append((form.form_label, form_datas))  | 
