Code

Opened 6 years ago

Closed 6 years ago

#7685 closed (fixed)

Error in Code example "local flavor"

Reported by: bernd Owned by: nobody
Component: Documentation Version: master
Severity: Keywords:
Cc: dev@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The first Code example don't work.

http://www.djangoproject.com/documentation/localflavor/

from django import newforms as forms
from django.contrib.localflavor import fr

class MyForm(forms.Form):
    my_french_phone_no = fr.forms.FRPhoneNumberField()

get this error/traceback:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "<console>", line 2, in MyForm
AttributeError: 'module' object has no attribute 'forms'

This works for me (changed the import part)

from django import newforms as forms
from django.contrib.localflavor.fr.forms import FRPhoneNumberField

class MyForm(forms.Form):
    my_french_phone_no = FRPhoneNumberField()

Attachments (1)

7685.diff (577 bytes) - added by Simon Greenhill 6 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 6 years ago by Karen Tracey <kmtracey@…>

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

This also came up on the mailing list a while ago:

http://groups.google.com/group/django-users/browse_thread/thread/1ff7a6501b4ca41c/d713c213999ec047

but in a quick search I can't find that the poster followed up with opening a ticket.

comment:2 Changed 6 years ago by Karen Tracey <kmtracey@…>

Also reported in #7749

Changed 6 years ago by Simon Greenhill

comment:3 Changed 6 years ago by Simon Greenhill

  • Has patch set
  • Triage Stage changed from Accepted to Ready for checkin

Here's one way of solving it.

comment:4 Changed 6 years ago by Simon Greenhill

  • Cc dev@… added

comment:5 Changed 6 years ago by mtredinnick

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

(In [7961]) Fixed #7685 -- fixed a typo in French localflavor 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.