Code

Changes between Version 11 and Version 12 of DataModelPitfalls


Ignore:
Timestamp:
04/03/06 04:22:13 (8 years ago)
Author:
ejf-django@…
Comment:

Added pitfall about forgetting to update all in model's init.py

Legend:

Unmodified
Added
Removed
Modified
  • DataModelPitfalls

    v11 v12  
    6565 
    6666You get tracebacks with {{{NameError}}}s in your modules as if the global wasn't there. 
     67 
     68 
     69== If You Find get_X_list, get_X_count, etc. Not Getting Created == 
     70 
     71If you have a model class (for example Choices) that has a ForeignKey, the class that is the foreign key (for example Polls) gets methods like get_X_list, get_X_count (for example, Polls.get_choice_list, Polls.get_choice_count). 
     72 
     73However, if you find those are not getting created, and you have a multi-file model, check to make sure that you have updated the __all__ variable in your model's __init__.py.  It can be tough to remember to update that with the list of all your files in your model.  If a particular model file isn't in __all__, those methods won't get created in your model objects.