Opened 2 years ago

Closed 2 years ago

#19801 closed Cleanup/optimization (fixed)

input_formats sample codes missing the required parenthesis

Reported by: leandron85@… Owned by: biern
Component: Documentation Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


In the Form Fields documentation, the DateField and DateTimeField examples of input_formats attribute are defined as lists, but the examples are not clear about that.

My suggestion is to use the parenthesis to enclosure the example, in order to be clear about this requirement :-)

(                                      <------------- add this
'%b %d %Y',       # 'Oct 25 2006'
'%b %d, %Y',      # 'Oct 25, 2006'
'%d %b %Y',       # '25 Oct 2006'
'%d %b, %Y',      # '25 Oct, 2006'
'%B %d %Y',       # 'October 25 2006'
'%B %d, %Y',      # 'October 25, 2006'
'%d %B %Y',       # '25 October 2006'
'%d %B, %Y',      # '25 October, 2006'
)                                          <------------ and this

Change History (6)

comment:1 Changed 2 years ago by leandron85@…

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

comment:2 Changed 2 years ago by timo

I don't feel strongly about this, but they look a little ugly/out of place which is probably why they were omitted in the first place. Right below input_formats it says "A list of formats" which seems pretty clear to me.

comment:3 Changed 2 years ago by carljm

  • Triage Stage changed from Unreviewed to Accepted

I don't have a strong opinion either, but I'd lean slightly towards explicitly making it a list, at least in the first example where we are showing the default value. I think the opening bracket could be placed at the beginning of the first line, rather than on its own line. Also: brackets, not parens. If we're calling it a list, let's make it a list, not a tuple.

(Anyone with a strong opinion on the aesthetics here, feel free to override me and close this wontfix, I'm just trying to get it off the unreviewed list :-) )

comment:4 Changed 2 years ago by biern

  • Owner changed from nobody to biern
  • Status changed from new to assigned

comment:6 Changed 2 years ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 8e5fbebe020878cdce98f8efce50bc337968b2ca:

Fixed #19801 - Added brackets to input_formats.

Thanks leandron85@ for the suggestion.

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