views:

28

answers:

2

For instance, I have a field in a model class called Role, and instead of creating a separate Role model by hand, that I then later have to write code to populate with 5 known values, is there a way to express that the Role field in my Person model can only hold those 5 known values?

A: 

Use the choices argument of the field's constructor.

Ignacio Vazquez-Abrams
+2  A: 

Here is the documentation on choices. http://docs.djangoproject.com/en/1.2/ref/models/fields/#choices in the admin site they appear as drop down boxes automatically:).
Dean

Dean