Changes between Version 6 and Version 7 of CookBookSplitModelsToFiles
- Timestamp:
- Jan 12, 2008, 5:37:06 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CookBookSplitModelsToFiles
v6 v7 1 1 = CookBook - [wiki:CookBookDataModels Data Models] - Splitting models across multiple files = 2 2 3 It is not clear that this works anymore. Using the development version, revision 7013, I got 4 {{{ 5 ./manage.py sqlall example 6 Error: App with label example could not be found. Are you sure your INSTALLED_APPS setting is correct? 7 }}} 8 9 10 11 To split models across multiple files, you can do the following (works at least with revision 2819): 3 To split models across multiple files, you can do the following (works at least with revision 2819; verified to work without the Meta class app_labels, with main branch revision 7013): 12 4 13 5 The important thing to notice here is the {{{app_label}}} attribute in the {{{Meta}}} class. If that is omitted, a subsequent {{{manage.py syncdb}}} run will not pick up these models. … … 28 20 29 21 class Poll(models.Model): 30 question = models.CharField(max length=200)22 question = models.CharField(max_length=200) 31 23 pub_date = models.DateTimeField('date published') 32 24 … … 43 35 class Choice(models.Model): 44 36 poll = models.ForeignKey(Poll) 45 choice = models.CharField(max length=200)37 choice = models.CharField(max_length=200) 46 38 votes = models.IntegerField() 47 39