Opened 8 years ago

Closed 4 years ago

Last modified 2 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: master
Severity: Normal Keywords: nested compound subforms superform formlist
Cc: joost@…, samdolan@…, woolford.thomas@…, Kronuz 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> 8 years ago.
superform.py (12.9 KB) - added by sdolan 5 years ago.
Updated version to work w/1.2 (should work with all 1.0+).
superform.2.py (13.0 KB) - added by sdolan 5 years ago.
Removed a debug raise statement that slipped by.
superforms.2.py (13.2 KB) - added by mnbayazit 5 years ago.
Added iter, getitem, and save()

Download all attachments as: .zip

Change History (15)

Changed 8 years ago by Jeroen van Dongen <jeroen at jkwadraat.net>

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

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 8 years ago by Gary Wilson <gary.wilson@…>

  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Design decision needed

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

comment:3 Changed 8 years ago by brosner

  • Resolution set to worksforme
  • Status changed from new to closed

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

comment:4 Changed 7 years ago by jcassee

  • 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 Changed 6 years ago by mccartney

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

Changed 5 years ago by sdolan

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

comment:6 Changed 5 years ago by sdolan

  • 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 Changed 5 years ago by twoolie

  • 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.

Changed 5 years ago by sdolan

Removed a debug raise statement that slipped by.

Changed 5 years ago by mnbayazit

Added iter, getitem, and save()

comment:8 Changed 4 years ago by cato

  • Easy pickings unset
  • Resolution worksforme deleted
  • Severity set to Normal
  • Status changed from closed to reopened
  • Type set to Uncategorized

Still not reviewed.

comment:9 Changed 4 years ago by russellm

  • Resolution set to wontfix
  • Status changed from reopened to closed

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 Changed 4 years ago by akaihola

  • 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 Changed 2 years ago by Kronuz

  • Cc Kronuz added
Note: See TracTickets for help on using tickets.
Back to Top