Horje
business logic in django Code Example
business logic 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.




Python

Related
How to config your flask for gmail Code Example How to config your flask for gmail Code Example
Why do we use graphs? Code Example Why do we use graphs? Code Example
interpoltaion search formula python Code Example interpoltaion search formula python Code Example
lcm python Code Example lcm python Code Example
how to ask someone for their name in python Code Example how to ask someone for their name in python Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10