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)
Change History (12)
by , 16 years ago
Attachment: | fieldset.diff added |
---|
comment:1 by , 16 years ago
milestone: | → post-1.0 |
---|---|
Needs documentation: | set |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 16 years ago
comment:3 by , 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 , 16 years ago
Attachment: | forms.txt.diff added |
---|
Forms documentation update for new functionality.
comment:4 by , 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:7 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:10 by , 12 years ago
Cc: | added |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
This is a duplicate of #6630 which has an extensive discussion as well as several approaches to that issue.
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?