Hi All,
problem solved.
The problem was the default value None for the form_class parameter at 
get_form.
It works when changing:
def get_form(self, form_class=None):
to:
def get_form(self, form_class=LayoutFormSet):

Cheers
Schaf


Am Dienstag, 31. Januar 2017 17:55:15 UTC+1 schrieb scha...@gmail.com:
>
> 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.
> 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+unsubscr...@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/3f60667e-4891-46da-834f-d9a80c0f4d8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to