Where should django manager code live?

前端 未结 4 2045
无人及你
无人及你 2021-02-01 18:15

This is a pretty simple django patterns question. My manager code usually lives in models.py, but what happens when models.py is really huge? Is there any other alternative patt

4条回答
  •  旧巷少年郎
    2021-02-01 18:58

    What I did when building Django apps was to create a [modelname].py file with just the specific model code, manager code and sometimes form code and used an __init__.py file to import then all in the models directory. This helped me atleast in keeping it managable.

提交回复
热议问题