Horje
purpose of meta class in django Code Example
what does class meta do in django
from django.db import models

class Ox(models.Model):
    horn_length = models.IntegerField()

    class Meta:
        ordering = ["horn_length"]
        verbose_name_plural = "oxen"
        
        
        //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.
purpose of meta class in django
purpose of meta class in django

Model Meta is basically the inner class of your model class. 
Model Meta is basically used to change the behavior of your model fields like changing order options,verbose_name and lot of other options. 
It's completely optional to add Meta class in your model




Python

Related
pandas df exact equals Code Example pandas df exact equals Code Example
how to create dictionary in python from csv Code Example how to create dictionary in python from csv Code Example
how to let only admins do a command in discord.py Code Example how to let only admins do a command in discord.py Code Example
how to make curl request python Code Example how to make curl request python Code Example
install google cloud python Code Example install google cloud python Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7