Code

Changes between Version 12 and Version 13 of DataModelPitfalls


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

minor edit to escape ForeignKey so it's not a wikiword

Legend:

Unmodified
Added
Removed
Modified
  • DataModelPitfalls

    v12 v13  
    6969== If You Find get_X_list, get_X_count, etc. Not Getting Created == 
    7070 
    71 If 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). 
     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). 
    7272 
    7373However, 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.