Code

Opened 6 years ago

Closed 12 months 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: master
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 6 years ago.
forms.txt.diff (2.2 KB) - added by jbowman 6 years ago.
Forms documentation update for new functionality.

Download all attachments as: .zip

Change History (12)

Changed 6 years ago by jbowman

comment:1 Changed 6 years ago by mtredinnick

  • milestone set to post-1.0
  • Needs documentation set
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by jbowman

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

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

Changed 6 years ago by jbowman

Forms documentation update for new functionality.

comment:4 Changed 6 years ago by jbowman

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

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:6 Changed 5 years ago by jbowman

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

comment:7 Changed 3 years ago by lukeplant

  • Severity set to Normal
  • Type set to New feature

comment:8 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:9 Changed 2 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:10 Changed 12 months ago by bmispelon

  • Cc bmispelon@… added
  • Resolution set to duplicate
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.