All development is made in accordance with the Django guidelines.
As such, it follows the Model View Template design pattern, which consists of the following three entities:
The user interacts with Automail using a URL that is used to redirect the requests to the appropriate View, which will interact with the Model to retrieve the necessary data from the database. The View will then render an appropriate Template along with the retrieved data to the user.
A Model is an object that defines the structure of the data in Automail and is an abstraction of database tables.
It is responsible for maintaining the entire application’s data for which it provides various mechanisms to add, update, read, and delete the data in the database.
The interaction with the database is always done through the Object Relational Mapper (never through direct SQL code).
The model is managed by models.py.
You can generate an Entity-Relationship diagram of your model through forward engineering by running python automail.py graph_models custom_web -a -o "[absolute path]\Data Model.png".
This requires the installation of pyDotPlus (pip install pydotplus).
A View is a handler function that accepts HTTP requests, processes them, and returns the HTTP response.
It retrieves the necessary data to fulfill the request using Models and renders them on the user interface using Templates.
It can also create an HTML page using an HTML template dynamically, and populate it with data fetched from the model.
The view is managed by urls.py and views.py.
A Template is a text file that defines the structure or layout of the user interface. The text file can be any type of file; for example HTML, XML, etc.
It can accept data from the view and render it using jinja syntax.