Geschäftslogik in Django
So where do we put business logic in Django?
Here are 4 possible solutions:-
Idea #1: Fat Models
I believe that the “default” idea supported by Django documentation is to make your models “fat.”
To put it colloquially, this approach suggests that if you don’t know where some of the code should go,
and it somehow relates to the object (and what doesn’t?), then it’s best to put it in the model.
Idea #2: Putting Business Logic in Views/Forms
Another idea is to place business logic in forms or views.
Though I’ve seen it being seriously suggested,
I don’t think that putting business logic in forms, views, or serializers is a clean idea.
Idea #3: Services
Another commonly advocated idea is that it’s worth to add a separate layer of code called services between views and models.
That is quite unusual in a vanilla Django system but some projects successfully employ that method.
To read full article click on the Source link below.
Markhor