Reputation: 2095
I am trying to figure out general guidelines for arranging views/templates in a django project with multiple apps so that the apps remain fairly re-usable.
For specific example:
I have a django project with three main apps:
- accounts
: That manages user account related stuff
- reports
: That generates reports
- courses
: That manages course contents
I also have a \templates
directory in the project, and have three directories under it corresponding to each of the three apps. This breakdown works well for me on pages that deal with individual app elements.
However, there are views and pages where I need to show information collected from all three apps. For example, I might want to show an overview page with the User payment status (accounts), his past reports(reports) and his current course(course).
I understand that apps must be kept as independent as possible. What are the guidelines for place views/templates that do not clearly belong to one app but import from different apps? Should I create a project-specific app just to hold these views/templates?
Upvotes: 1
Views: 174
Reputation: 34593
It depends on how re-usable you need to make these shared templates. I often just put these sorts of templates into a "shared" directory. Sometimes I'll have a "shared" that applies to the entire project, and sometimes I'll have one that is shared within an app. It just depends on what works best for you.
Upvotes: 2