On Sun, Dec 20, 2009 at 12:22 PM, Todd Blanchard <[email protected]> wrote:
> I think what i actually want is a form set, but I don't find that all that
> well done either.

I would like to point out that so far, you haven't actually told us
what your problem *is*. You've asked how Django does something that
Rails can apparently do, but you haven't told us what problem Rails is
trying to solve when it does what you describe.

> What I'm finding lacking is the ability to put a master/detail relationship
> in a single form.  For instance, Author/Books.  Furthermore, I don't see a
> nice way to work with dynamically expanding forms - IOW, allow the user to
> keep adding books to an Author using DHTML.

That's because Django doesn't handle this problem as a single form.
Instead, Django treats each database object as a separate form, and
then you put multiple forms into your view. When you have multiple
related objects (e.g., multiple books related to a single author), you
have a form for the author, then a FormSet [1] for the collection of
books. The formset is itself a collection of forms, one form for each
book.

[1] http://docs.djangoproject.com/en/dev/topics/forms/formsets/

As for dynamically expanding forms - Django treats that as a client
side problem. Django doesn't ship with any javascript dependencies in
it's form library, so it doesn't provide dynamically expanding forms
out of the box.

It's not that difficult to do, though. You just have to dynamically
create form elements, and tweak the formset management fields [2] in
the submitted form.

[2] 
http://docs.djangoproject.com/en/dev/topics/forms/formsets/#formset-validation

> So far my impression of forms is - ick - lame.

You've been told this before, but it bears repeating: if you'd like to
continue to receive the assistance of those in the Django community,
you might want to consider toning down the epithets. If you don't, you
might find your calls for assistance being ignored by the people that
are best able to assist you.

Yours,
Russ Magee %-)

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to