diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-06-04 11:36:23 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-06-04 11:36:23 +0200 |
| commit | 3169ce41c64c35c4f0e3bb32379e7e46d7f3aceb (patch) | |
| tree | beea591afc8404a43f8a5c060a70e7bd6ef9ae1b | |
| parent | a6c19e1eb98d30b5de2df3091ce875cb901a4c05 (diff) | |
| download | Ishtar-3169ce41c64c35c4f0e3bb32379e7e46d7f3aceb.tar.bz2 Ishtar-3169ce41c64c35c4f0e3bb32379e7e46d7f3aceb.zip | |
Wizard: allow fields initialization with GET
| -rw-r--r-- | ishtar_common/wizards.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index ab17ff422..9d69577c3 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -1227,16 +1227,20 @@ class Wizard(IshtarWizard): return self.get_instanced_init(current_obj, step) current_form = self.form_list[current_step] + initial = MultiValueDict() if hasattr(current_form, 'currents'): - initial = MultiValueDict() for key in current_form.currents: model_name = current_form.currents[key].__name__.lower() val = model_name in request.session and \ request.session[model_name] if val: initial[key] = val - if initial: - return initial + if not initial and hasattr(current_form, "base_fields"): + for k in current_form.base_fields: + if self.request.GET.get(k, None): + initial[k] = self.request.GET[k] + if initial: + return initial return super(Wizard, self).get_form_initial(step) def get_object_name(self, obj): |
