1# All Django Class Meta Attributes
2abstract
3app_label
4base_manager_name
5db_table
6Table names
7db_tablespace
8default_manager_name
9default_related_name
10get_latest_by
11managed
12order_with_respect_to
13ordering
14permissions
15default_permissions
16proxy
17required_db_features
18required_db_vendor
19select_on_save
20indexes
21unique_together
22index_together
23constraints
24verbose_name
25verbose_name_plural
1from django.db import models
2
3class Ox(models.Model):
4 horn_length = models.IntegerField()
5
6 class Meta:
7 ordering = ["horn_length"]
8 verbose_name_plural = "oxen"
9
10
11 //Model metadata is “anything that’s not a field”, such as ordering options (ordering), database table name (db_table), or human-readable singular and plural names (verbose_name and verbose_name_plural). None are required, and adding class Meta to a model is completely optional.
12
1purpose of meta class in django
2
3Model Meta is basically the inner class of your model class.
4Model Meta is basically used to change the behavior of your model fields like changing order options,verbose_name and lot of other options.
5It's completely optional to add Meta class in your model