Code

Opened 7 years ago

Closed 6 years ago

#6067 closed (worksforme)

Small addition to newForms documentation regarding required fields in templates

Reported by: stp2007 <stp2007@…> Owned by: nobody
Component: Forms Version: master
Severity: Keywords: documentation
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

In the documentation:
http://www.djangoproject.com/documentation/newforms/#highlighting-required-fields-in-templates

It might be useful to give an example of how to check if a field is required when accessing a form field directly. This would be in addition to the existing example which is demonstrating use when iterating over a form.

I'd suggest an example such as {% if form.fieldName.field.required %}*{% endif %}

Thanks

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by guettli

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

The documentation: http://www.djangoproject.com/documentation/newforms/#complex-template-output already contains
an example, that you can use {{ form.fieldname }}.

Nevertheless thank you for trying to improve the documentation.

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.