Yes, I do think explicitly building each view like the views are built at
present is not the correct solution. By these views should exist I meant
more there should be a view which handles these cases, not necessarily does
the logic itself.

Russ - we should talk about this properly at some point, I think we have
similar ideas about where this should go. I've got some concepts banging
around in my head for gcbv2 but they're a bit unclear.

Andrew - you're right into that the cross dependencies of forms/formsets on
the page is definitely something to consider. This is probably something
which is pretty ugly away from the issue of class based views though.
On 20 Sep 2013 09:53, "Andrew Ingram" <[email protected]> wrote:

> Having basically built all of the views in question, I agree with Russell.
> By having multiple form classes in a view itself, you're essentially
> pulling validation logic out of the form and into the view where it doesn't
> belong. A view shouldn't be concerned with the specifics of validation, it
> should be concerned with what to do once you have the validated data.
>
> For example: I have a Form and a FormSet, I have a field on the form that
> is only required if the formset has zero rows. Conventional solutions
> involving having the form and formset on the view are all pretty ugly.
> Whereas if the form itself knows how to validated any "subforms", you get
> much better options.
>
> I'm not entirely sold on the concept of FormContainer, i'd learn more
> towards new fields like `forms.SubForm(MyForm)` or
> `forms.SubFormSet(MyFormSet)` (assuming such a thing is achievable). Then
> we get a nice a familiar API, and are able to do things on the parent form
> such as being able to define a clean_* method for subforms/sets.
>
>
> Andy
>
>
> On 20 September 2013 07:55, Russell Keith-Magee 
> <[email protected]>wrote:
>
>>
>> On Fri, Sep 20, 2013 at 2:41 PM, Marc Tamlyn <[email protected]>wrote:
>>
>>> This is partly because there's no obvious correct implementation of them
>>> ;)
>>>
>>> Yes, I think these views should exist. But they go with the same body of
>>> work as handling multiple forms, inline formsets etc. At present I have no
>>> yet found the time to think about this problem, as a whole and come up with
>>> a single consistent solution.
>>>
>> I'm not sure FormSetView *should* exist. I'd be a lot more inclined to
>> look at something like FormContainer -- a form-like container that can
>> contain multiple forms and formsets. There's a sample implementation on
>> #18830 in the context of extending FormWizard to support combinations of
>> form and formset.
>>
>> https://code.djangoproject.com/ticket/18830
>>
>> If you had a form container, you wouldn't need a new generic view -- you
>> can just use FormView, and use the FormContainer as the form.
>>
>> (I'd also like to rethink generics in general, but that's a whole other
>> conversation… and one that I need to internally progress from vauge
>> rambling to slightly coherent proposal… and then find time to work on :-)
>>
>> Yours,
>> Russ Magee %-)
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/django-developers.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-developers.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to