Code

Opened 7 years ago

Closed 7 years ago

#4970 closed (invalid)

documentation - Newforms - Overriding The Default Field Types

Reported by: anonymous Owned by: nobody
Component: Documentation Version: master
Severity: Keywords: newforms
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I assume the code sample:

>>> def my_callback(field, **kwargs):
...     if isinstance(field, models.DateField):
                             ^^^^^^
...         return MyDateFormField(**kwargs)
...     else:
...         return field.formfield(**kwargs)

should read

>>> def my_callback(field, **kwargs):
...     if isinstance(field, forms.DateField):

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by PhiR

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

No. The callback takes a model field in argument and decides which form field to use to edit it.

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.