Code

Opened 5 years ago

Closed 3 years ago

#11935 closed New feature (fixed)

Add a get_context(self, request, step) method to FormWizard

Reported by: Rob Hudson <treborhudson@…> Owned by: nobody
Component: contrib.formtools Version: 1.1
Severity: Normal Keywords: formwizard
Cc: treborhudson@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX:

Description

If you want to simply add context to a step of a FormWizard there are currently two documented ways, both of which have shortcomings...

  1. Override render_template. The problem with this is quite a bit is happening in the to the variables in the context. The user mostly has to copy/paste the code, get it right, and hope this method doesn't change out from underneath him for future releases, just to add context.
  1. Override process_step. If the above turns the user's stomach, this seems like the next best place. The problem, as noted in the documentation, is that "... this method is called every time a page is rendered for all submitted steps." If you are only adding context, not processing anything, this can result in a pretty heavy load, for example if you are doing database calls to get a list of objects to display on a certain step.

I'm proposing adding a method just for adding context to any given step, and make it called only when the step is rendered.

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Not necessarily sold on adding a method as the solution, but the idea (allowing for extra_context) is certainly valid.

comment:2 Changed 3 years ago by julien

  • Severity set to Normal
  • Type set to New feature

comment:3 Changed 3 years ago by jezdez

  • Easy pickings unset
  • Resolution set to fixed
  • Status changed from new to closed

Superseded by #9200.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.