Hi All,
in a view deriving from UpdateView the form_class attribute gets assigned with a formset.
the View then overrides the get_form function.
I'm just wondering if this is a nice way of using the formset? Normally a form is assigned to form_class.
Thanks for hints
Schaf
-- in a view deriving from UpdateView the form_class attribute gets assigned with a formset.
the View then overrides the get_form function.
class RLFormView(LoginRequiredMixin, StaffuserRequiredMixin, UpdateView):
template_name = 'abc/layout.html'
form_class = LayoutFormSet
fields = '__all__'
....
def get_form(self, form_class=None):
if self.request.POST:
return form_class(self.request.POST)
else:
initial = [{'param': 'a',
'choosen': 'value'}]
return form_class(initial=initial)
I'm just wondering if this is a nice way of using the formset? Normally a form is assigned to form_class.
Thanks for hints
Schaf
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bd486779-293d-42e8-8148-8562e05f71c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment