Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
working example of django.contrib.localflavor ?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
e  
View profile  
 More options Apr 14 2008, 11:58 am
From: e <erict...@gmail.com>
Date: Mon, 14 Apr 2008 08:58:26 -0700 (PDT)
Local: Mon, Apr 14 2008 11:58 am
Subject: working example of django.contrib.localflavor ?
I have a form set up and all working, its basically straight out of
the Form Processing chapter of the django book:

class ContactForm(forms.Form):
    email = forms.EmailField(required=True)
    message = forms.CharField()
    phone_number = forms.CharField()

def contact(request):
    form = ContactForm()
    return render_to_response('contact.html', {'form': form})

Now this works just fine, but I want to use
django.contrib.localflavor.us.forms.USPhoneNumberFIeld instead of the
CharField for the phone_number.  When I replace it with this line:

phone_number = us.forms.USPhoneNumberField(max_length=100)

I get this error:

ViewDoesNotExist: Tried contact in module mysite.contact.views. Error
was: 'module' object has no attribute 'forms'

What am I doing wrong?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Karen Tracey  
View profile  
 More options Apr 14 2008, 2:10 pm
From: "Karen Tracey" <kmtra...@gmail.com>
Date: Mon, 14 Apr 2008 14:10:20 -0400
Local: Mon, Apr 14 2008 2:10 pm
Subject: Re: working example of django.contrib.localflavor ?

I'm assuming you have:

from django.contrib.localflavor import us

somewhere before you try to define phone_number as us.forms.USPhone...

Instead try:

from django.contrib.localflavor.us.forms import USPhoneNumberField
phone_number = USPhoneNumberField()

This works for me.  I don't know why the documentation (
http://www.djangoproject.com/documentation/localflavor/) shows an example
using the first kind of import, since it does not appear that things are set
up for that to work.

Karen


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
e  
View profile  
 More options Apr 15 2008, 2:19 pm
From: e <erict...@gmail.com>
Date: Tue, 15 Apr 2008 11:19:47 -0700 (PDT)
Local: Tues, Apr 15 2008 2:19 pm
Subject: Re: working example of django.contrib.localflavor ?
Is this worthy of submitting a ticket to fix the documentation for?

On Apr 14, 2:10 pm, "Karen Tracey" <kmtra...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Karen Tracey  
View profile  
 More options Apr 15 2008, 2:33 pm
From: "Karen Tracey" <kmtra...@gmail.com>
Date: Tue, 15 Apr 2008 14:33:26 -0400
Local: Tues, Apr 15 2008 2:33 pm
Subject: Re: working example of django.contrib.localflavor ?

On Tue, Apr 15, 2008 at 2:19 PM, e <erict...@gmail.com> wrote:
> Is this worthy of submitting a ticket to fix the documentation for?

I'd say so.  Near as I can tell if you cut & paste the example from the
documentation it doesn't work.  That seems wrong, and worth fixing.

Karen


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »