Opened 16 years ago

Closed 12 years ago

#8272 closed New feature (duplicate)

Patch to forms to add a fieldset attribute to Field for use with templates

Reported by: jbowman Owned by: jbowman
Component: Forms Version: dev
Severity: Normal Keywords:
Cc: bmispelon@… Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I needed to create a complex form that used fieldsets to divide sections of the form. I finally figured out that to do this, I needed to modify the forms code a bit. I've tested this patch against the latest version of svn and it worked. Below is a snippet of a template to show you how you would use the new fieldset attribute for more complex form layouts. The diff file is attached.

<form action="." method="post">

{% regroup form by fieldset as fields_list %}
{% for field in fields_list %}

<fieldset>
<legend>{{ field.grouper|upper }}</legend>
{% for f in field.list %}

{{ f.label_tag }} {{ f }}

{% endfor %}
</fieldset>

{% endfor %}

<input type="submit" value="Submit" />
</form>

Attachments (2)

fieldset.diff (1.8 KB ) - added by jbowman 16 years ago.
forms.txt.diff (2.2 KB ) - added by jbowman 16 years ago.
Forms documentation update for new functionality.

Download all attachments as: .zip

Change History (12)

by jbowman, 16 years ago

Attachment: fieldset.diff added

comment:1 by Malcolm Tredinnick, 16 years ago

milestone: post-1.0
Needs documentation: set
Triage Stage: UnreviewedAccepted

comment:2 by jbowman, 16 years ago

This is my first submission to Django. I'll glady document the feature. I realize this would need to be updated in the forms documentation, but should it also be documented in templates? Is the process for documentation the same as code, create a .diff of the documentation and submit it?

comment:3 by Malcolm Tredinnick, 16 years ago

Probably only in forms.txt. Although I'm not really sure what the documentation will look like. I mostly checked that box to mean "we should do something". We aren't going to get to really looking at this and deciding if the approach is exactly what we want to do for at least a month or two, since we're really in 1.0 mode now. But it looks simple enough that something like this is worth doing. So write some documentation so we can all see what it might look like when you get a chance. It's always easier to critique stuff that already exists than just saying "we should do something like that".

by jbowman, 16 years ago

Attachment: forms.txt.diff added

Forms documentation update for new functionality.

comment:4 by jbowman, 16 years ago

Not sure why, but when I view the diff file I created for documentation via the website, it appears empty. Looking at it in vi it's fine. If you need me to do something different, please let me know. I'm leaving it flagged as "needs documentation" as I figure it's up to you all to determine when the documentation is complete.

comment:5 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

comment:6 by jbowman, 16 years ago

Does the milestone deletion mean this isn't planned for any release?

comment:7 by Luke Plant, 14 years ago

Severity: Normal
Type: New feature

comment:8 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:9 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:10 by Baptiste Mispelon, 12 years ago

Cc: bmispelon@… added
Resolution: duplicate
Status: newclosed

This is a duplicate of #6630 which has an extensive discussion as well as several approaches to that issue.

Note: See TracTickets for help on using tickets.
Back to Top