I have a FormView view, with some additional GET context supplied using get_context_data():
class SignUpView(FormView):
template_name = 'pages_fixed/accounts/signup.html'
form_class = SignUpForm
def get_context_data(self, **kwargs):
context = super(SignUpView, self).get_context_data(**kwargs)
context = {
'plans': common.plans,
'pricing': common.pricing,
}
return context
This works fine. However, I also have some values in session (not from any bound model) which I would like to pre-populate into the form. These vary depending on user's actions on previous page(s). I know (from my other post) that I can pass the form into the context (with initial=
) but is it possible in a FormView situation per above?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…