0
votes

''' from django.db import models import uuid class Book(models.Model): name=models.CharField(max_length=100) isbn=models.UUIDField(default=uuid.uuid4, primary_key=True) writer=models.CharField(max_length=100)

    class Meta:
        ordering=['name']
        ordering='User MetaData'''
1

1 Answers

0
votes

1.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.

2.Verbose_name is a human-readable name for the field.

3.Ordering takes a list of string values, which are model fields. It's used to define the ordering of objects of a model. When the objects of this model are retrieved, they will be present in this ordering.