Code

#18832 closed Bug (fixed)

The example for excluding field from forms uses the wrong field.

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

Description

In this section: https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form

The first paragraph shows excluding the birth_date field from the form. Then the Note shows how to be sure the field is available when the model is saved, but the examples there provide title, not birth_date. The examples should be fixed to deal with the same excluded field.

Attachments (0)

Change History (4)

comment:1 Changed 20 months ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 20 months ago by nickmartini

  • Owner changed from nobody to nickmartini

comment:3 Changed 20 months ago by nickmartini

  • Has patch set

I noticed that in the example code in the docs, a non-required field (birth date) was excluded, and then the required 'title' field was manually added to the form even though it had not been excluded. I chose to exclude the required field 'title' instead, leaving it manually added in the example.

https://github.com/django/django/pull/359

comment:4 Changed 20 months ago by Tim Graham <timograham@…>

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

In [76bd33539f8a188c4b1770babe6d2b55e5030c68]:

Merge pull request #359 from nmartini/ticket_18832

Fixed #18832 - Updated ModelForm example fields to match note below

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.