0

I'm trying out Django/Mezzanine and if I have a custom user profile as such:

class UserProfile(models.Model):
    user = models.OneToOneField("auth.User")
    street_address1 = models.CharField(max_length=100)
    street_address2 = models.CharField(max_length=100)
    postalcode = models.CharField(max_length=10)
    city = models.CharField(max_length=32)
    country = models.CharField(max_length=2)
    phone = models.CharField(max_length=15)

Mezzanine creates a sign up form at account/signup/ and I would like to modify the Country field to have a drop down list of countries from a table or xml file. The foreign key is a two character field.

How should go about doing this? Do I create a model form or try to extend the right template (tried looking at accounts\templates\account_form.html but don't think it is there?

mrkre
  • 1,548
  • 15
  • 43

1 Answers1

0

I believe if you defined a "choices" arg for the field, it'll do just that:

https://docs.djangoproject.com/en/dev/ref/models/fields/#choices

A quick Google search will probably also reveal some pre-built packages for country lists.

Steve
  • 1,726
  • 10
  • 16