I have a user profile model that gets accessed from the admin section of my 
site:

class UserProfile(models.Model):
    MARKETS = [('B', 'Both'),
               ('D', 'Domestic'),
               ('I', 'International')]

    market = models.CharField(maxlength=1, choices=MARKETS, core=True)

When viewed in /admin, that field appears as the expected select widget.  
I'm trying to wrap this (and a few other models) into a user-editable page 
elsewhere on the site, but it's giving me fits:

>>> form = newforms.form_for_instance(umod.UserProfile())()
>>> print form['market']
<input id="id_market" type="text" name="market" maxlength="1" />

Is there a way to get it to render as a select widget with the same values 
as in /admin?  I'm going to be doing such things quite a few times and I 
don't want to have to repeat the same definitions in a bunch of places.

Many thanks,
-- 
Kirk Strauser

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to