Code

Changes between Version 6 and Version 7 of CookBookSplitModelsToFiles


Ignore:
Timestamp:
01/12/08 15:37:06 (6 years ago)
Author:
nara19
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CookBookSplitModelsToFiles

    v6 v7  
    11= CookBook - [wiki:CookBookDataModels Data Models] - Splitting models across multiple files = 
    22 
    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): 
     3To 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): 
    124 
    135The 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. 
     
    2820 
    2921class Poll(models.Model): 
    30     question = models.CharField(maxlength=200) 
     22    question = models.CharField(max_length=200) 
    3123    pub_date = models.DateTimeField('date published') 
    3224 
     
    4335class Choice(models.Model): 
    4436    poll = models.ForeignKey(Poll) 
    45     choice = models.CharField(maxlength=200) 
     37    choice = models.CharField(max_length=200) 
    4638    votes = models.IntegerField() 
    4739