Note: You can find the implementation of this model in the models.py file.
The Brand
model inherits from the BaseModel
, which provides common fields and functionalities for tracking creation
and update times. The model includes the following fields:
Field Name | Field Type | Description |
---|---|---|
name |
CharField | The name of the brand. (Max length: 150) |
nationality |
ForeignKey to Nationality | The nationality associated with the brand. (Related name: brands , On-Delete: Protect ) |
updated |
DateTimeField | The last time the instance was updated. |
created |
DateTimeField | The creation time of the instance. |
The Brand
model is associated with a custom manager called BrandManager
. The custom manager provides a custom
queryset method to optimize database queries by select_related Nationality
objects when fetching Brand
objects.
Note: You can find the implementation of this manager in the managers.py file.