In django, how can I include some default records in my models.py?
- by kdt
If I have a models.py like
class WidgetType(models.Model):
name = models.CharField(max_length=200)
class Widget(models.Model):
typeid = models.ForeignKey(WidgetType)
data = models.CharField(max_length=200)
How can I build in a set of built in constant values for WidgetType when I know I'm only going to have a certain few types of widget? Clearly I could fire up my admin interface and add them by hand, but I'd like to simplify configuration by having it built into the python.