Category: 3. Models

  • Update Model

    Django’s ORM API provides useful functionality for performing CRUD operations on the data stored in the tables of relational databases. The create(), update() and delete() methods perform their respective operations on an already existing table. However, you often need to make changes to the model structure itself, by adding, deleting or altering the attributes of the model. Django’s admin…

  • Update Data

    Django ORM uses the Active Record pattern for the interaction between a model class and its mapped database table. An instance of the model class corresponds to a single row in the table. Any of the attributes of the object results in updating the corresponding row. In this chapter, we will focus on the different…

  • Insert Data

    Django has its own Object Relation Model (ORM) that maps a Python class with a table in a relational database. The ORM mechanism helps in performing CRUD operations in object-oriented manner. In this chapter, we shall learn about different methods of inserting a new data. By default, Django uses a SQLite database. A model in…

  • Models

    A model is a class that represents table or collection in our DB, and where every attribute of the class is a field of the table or collection. Models are defined in the app/models.py (in our example: myapp/models.py) Creating a Model Following is a Dreamreal model created as an example − Every model inherits from…