What are models in Django?
Let’s create a Product table with name, price, and description attributes.
#models.py
from django.db import models#product modelclass Product(models.Model): name= models.CharField(max_length=30) price= models.models.IntegerField() description = models.TextField() def __str__(self): return f'{self.name}'保存以便复习
保存以便复习
收藏此条目、标记为困难题,或将其加入复习集合。