On Mar 30, 8:49 pm, erikankrom <[EMAIL PROTECTED]> wrote: > 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?
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 received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---