Opened 17 years ago

Closed 13 years ago

Last modified 11 years ago

#3706 closed Uncategorized (wontfix)

[patch] Support for nested/compound forms for newforms

Reported by: Jeroen van Dongen <jeroen at jkwadraat.net> Owned by: nobody
Component: Forms Version: dev
Severity: Normal Keywords: nested compound subforms superform formlist
Cc: joost@…, samdolan@…, woolford.thomas@…, German M. Bravo Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

The attached file contains a few classes to provide the ability to nest forms in forms.
See also http://groups.google.com/group/django-developers/t/b39ec8990e756b53.

Attachments (4)

superforms.py (15.4 KB ) - added by Jeroen van Dongen <jeroen at jkwadraat.net> 17 years ago.
superform.py (12.9 KB ) - added by sdolan 14 years ago.
Updated version to work w/1.2 (should work with all 1.0+).
superform.2.py (13.0 KB ) - added by sdolan 14 years ago.
Removed a debug raise statement that slipped by.
superforms.2.py (13.2 KB ) - added by mnbayazit 14 years ago.
Added iter, getitem, and save()

Download all attachments as: .zip

Change History (15)

by Jeroen van Dongen <jeroen at jkwadraat.net>, 17 years ago

Attachment: superforms.py added

comment:1 by Jeroen van Dongen <jeroen at jkwadraat.net>, 17 years ago

In the current state it's useable except for the FormList functionality. There's something wrong with it (see Known bugs in the attached file), but I've currently no time to hunt it down, has to wait 'till later this week.

comment:2 by Gary Wilson <gary.wilson@…>, 17 years ago

Patch needs improvement: set
Triage Stage: UnreviewedDesign decision needed

Have you looked at the FormSet code recently added to django.newforms.formsets in the newforms-admin branch?

comment:3 by Brian Rosner, 17 years ago

Resolution: worksforme
Status: newclosed

I am closing this ticket as support for this is already in newforms-admin in django.newforms.formsets.

comment:4 by Joost Cassee, 16 years ago

Cc: joost@… added

As I see it this is not at all like the FormSet. The FormSet is about multiple forms *of the same type*, while superform.py allow compound or nested forms. See the doctest code.

I believe this functionality is not yet present in Django. Please reopen if I am correct.

comment:5 by mccartney, 15 years ago

I confirm, form sets are something different.
I would vote for having the nested forms.

by sdolan, 14 years ago

Attachment: superform.py added

Updated version to work w/1.2 (should work with all 1.0+).

comment:6 by sdolan, 14 years ago

Cc: samdolan@… added

I updated this patch in response to a stack overflow question http://stackoverflow.com/questions/3114656/django-compound-nested-subforms. I removed the doctests, and added unittests (in my own "django-common" repository) that have ~90% coverage covering the different form combinations (ModelForms, multiple SubForms, and mixed Fields + SubForms). If this is something people are interested I can work up a patch that integrates the SubForm class into the Django core with accompanying unit tests/docs.

comment:7 by twoolie, 14 years ago

Cc: woolford.thomas@… added

I think that if people knew about this patch they would be VERY interrested. This could make complicated form creation far easier by removing the mix an math approach of putting a ton of tiny forms in a template and combining all the data manually in one's view.

by sdolan, 14 years ago

Attachment: superform.2.py added

Removed a debug raise statement that slipped by.

by mnbayazit, 14 years ago

Attachment: superforms.2.py added

Added iter, getitem, and save()

comment:8 by cato, 13 years ago

Easy pickings: unset
Resolution: worksforme
Severity: Normal
Status: closedreopened
Type: Uncategorized

Still not reviewed.

comment:9 by Russell Keith-Magee, 13 years ago

Resolution: wontfix
Status: reopenedclosed

It wasn't reviewed because the fundamental idea was rejected. If you think the idea should be reconsidered, you need to start a discussion on Django-dev, not just reopen the ticket.

comment:10 by Antti Kaihola, 12 years ago

UI/UX: unset

Why not make a reusable app out of this patch and put it on PyPI and djangopackages.com? Wouldn't it make sense since the patch doesn't modify Django at all, just adds some classes.

comment:11 by German M. Bravo, 11 years ago

Cc: German M. Bravo added
Note: See TracTickets for help on using tickets.
Back to Top