As we approach the end of this chapter, we should now be familiar with all the possibilities models give us to structure data models.
We have seen that models are usually based on the models.Model
class, but we can also use models.Abstract
for reusable mixin models and models.Transient
for wizards or advanced user interaction dialogs. We have seen the general model attributes available, such as_order
for default sort order, and_rec_name
for the default field to use for record representation.
The fields in a model define all the data they will store. We have also seen the non-relational field types available, and the attributes they support. We also learned about the several types of relational fields, many-to-one, one-to-many, and many-to-many, and how they define relationships between models, including hierarchical parent/child relationships.
Most fields store user input in the database, but fields can have values automatically computed by Python code. We have seen how to implement...