2

I'm working on a subset of my projects functionality, and I'm trying to focus on breaking my project into focused apps (as opposed to one monolithic app that does it all). After some googling, I want to keep each app tight and focused. However, I'm not exactly sure of the best way to divide up my code.

The overall functionality has three basic components:

  1. Employees and their associated information.
  2. Certificates/employee training and certificate information. Basically different types of training employees can receive and associated information.
  3. Employee certifications (this links certificates to employees).

I have three main models: Employee, Certificate and Certification (which shares a relationship with both Employees and Certificates).

I could throw all three into a single app, as all three objectives are somewhat related, or, I could divide up the work. In the latter, two of the three are easy: employees and certificates can both exist without the other and have their own app, but certificates I'm not so sure about.

I could:

  1. Bundle certifications in the employee or certificate app
  2. Give certifications their own app

What say you? Does this scenario warrant more than one app? And if so, how should the three functionality requirements be divided up to keep each one tight and focused?

Emma
  • 2,012
  • 5
  • 21
  • 30

2 Answers2

2

I would keep them all in a single app. It's too simple of an app (personally) for me to break it up. I would take advantage of django.contrib.auth.models.Users and build off of that in a structure which looks like this.

Model Diagram

To take advantage of the users structure you need to extend the User model. Stackoverflow answers here and official documentation here.

HTH

Community
  • 1
  • 1
rh0dium
  • 6,811
  • 4
  • 46
  • 79
2

I would advice to keep them in a single app : so all your models go into a single models.py, and rather have multiple views.py (say for every functional unit). This way, you can manage your models easily and also hit the right views file as required.

Keeping in multiple apps in this case would be an overkill, as there is no clear demarcation between the functionalities.

sprezzatura
  • 472
  • 5
  • 17