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
localflavor in admin
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
 
erikankrom  
View profile  
 More options Mar 30 2008, 3:49 pm
From: erikankrom <erikank...@gmail.com>
Date: Sun, 30 Mar 2008 12:49:41 -0700 (PDT)
Local: Sun, Mar 30 2008 3:49 pm
Subject: localflavor in admin
I have a model:

from django.db import models
from django import newforms as forms
from django.contrib.localflavor.us import forms as us_forms

class Address(models.Model):
        member                  = models.ForeignKey(Member, unique=True)
        street                  = models.CharField(max_length=50)
        city                    = models.CharField(max_length=30)
        state                   = us_forms.USStateSelect()
        zip                     = us_forms.USZipCodeField()
        description             = models.CharField(max_length=50)
        is_preferred            = models.BooleanField(default=False)

I can't get Address.city or Address.state to show up in admin forms.
What am I missing here?


 
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.
Daniel Roseman  
View profile  
 More options Mar 30 2008, 4:49 pm
From: Daniel Roseman <roseman.dan...@googlemail.com>
Date: Sun, 30 Mar 2008 13:49:48 -0700 (PDT)
Local: Sun, Mar 30 2008 4:49 pm
Subject: Re: localflavor in admin
On Mar 30, 8:49 pm, erikankrom <erikank...@gmail.com> wrote:

The Localflavor fields are form fields, not model fields. You can't
use them in a model definition. (I presume it's Address.zip you can't
see, not Address.city.)

If you are using newforms_admin, you could override
formfield_for_dbfield in your model form definition and return the
relevant formfields. Otherwise, you can use the built-in USStateField
model field, but there is no equivalent USZipCodeField - although
there's nothing to stop you rolling your own, see
http://www.djangoproject.com/documentation/custom_model_fields/
--
DR.


 
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.
Evert Rol  
View profile  
 More options Mar 30 2008, 4:55 pm
From: Evert Rol <evert....@gmail.com>
Date: Sun, 30 Mar 2008 21:55:16 +0100
Local: Sun, Mar 30 2008 4:55 pm
Subject: Re: localflavor in admin

The only reason I can think of right now, is that you added those  
later, after you initially created your models and the database.
Since city is practically the same as street, there shouldn't  
otherwise be any difference between the two telling the admin not to  
show the first. Unless you have code elsewhere that may prevent this.

 
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.
erikankrom  
View profile  
 More options Mar 30 2008, 6:13 pm
From: erikankrom <erikank...@gmail.com>
Date: Sun, 30 Mar 2008 15:13:10 -0700 (PDT)
Local: Sun, Mar 30 2008 6:13 pm
Subject: Re: localflavor in admin
Sorry, I was referring to the state and zip fields.  After modifying
my model, doing a sqlreset, and implementing the changes, they now
show up.  Thanks!

I was confused between the functionality of the forms and the fields
in models.  I'll get into the widget usage in the forms when building
more of the frontend I assume.

Why is this functionality not implemented in admin as easily as it is
in the forms usage?  To me, this would be pretty useful in the admin
area as well, just a thought.

On Mar 30, 3:55 pm, Evert Rol <evert....@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.
End of messages
« Back to Discussions « Newer topic     Older topic »