Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#16179 closed New feature (fixed)

Formwizard enhancement proposal

Reported by: hvdklauw Owned by: nobody
Component: contrib.formtools Version: master
Severity: Normal Keywords: dceu2011
Cc: hvdklauw@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'd like to propose the following changes to the formwizard:

Add kwargs to the get_initkwargs method to allow for calling the wizard from the urls.py with changed attributes (storage, template_name)
The reasons behind this that the same wizard might be used in multiple locations and you might for instance want to change the storage backend based on the fact if the user is logged in or not.

Add extra_context as a default attribute and use it in the get_extra_context, this I needed when I tried to get the wizard integrated in the admin add and change views. Here some extra context for the templates is needed to get everything working correctly (breadcrumbs etc). This way a user could specify a wizard that is also used in the frontend without needing to change anything for the admin.

I'll be working on this during the djangocon eu 2011 sprints :)

Attachments (1)

16179.diff (5.6 KB) - added by hvdklauw 4 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 4 years ago by hvdklauw

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Changed 4 years ago by hvdklauw

comment:2 Changed 4 years ago by hvdklauw

  • Cc hvdklauw added
  • Keywords dceu2011 added

comment:3 Changed 4 years ago by hvdklauw

  • Cc hvdklauw removed

comment:4 Changed 4 years ago by hvdklauw

  • Cc hvdklauw@… added

comment:5 Changed 4 years ago by steph

To add extra context to your template you could override the get_context_data method. I think this is a better approach instead of having more and more code in urls.py files.

comment:6 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

In [16368]:

Fixed #16179 -- Extended argument handling of the new WizardView a little to behave the same as the rest of the generic class based views. Also cleaned up the template loading in its tests a bit. Thanks, Harro van der Klauw.

comment:7 Changed 3 years ago by jacob

  • milestone 1.4 deleted

Milestone 1.4 deleted

Note: See TracTickets for help on using tickets.
Back to Top