from django.db import models
# Create your models here.
class Question(models.Model):
question_text=models.CharField(max_length=200)
pub_date=models.DateTimeField(name='published time')
def __str__(self) -> str:
return self.question_text
class Choice(models.Model):
question=models.ForeignKey(to=Question,on_delete=models.CASCADE)
votes=models.IntegerField(default=1)
Python Django 4.2.5教程:<模型类名>.objects.filter过滤查询示例
猜你喜欢
转载自blog.csdn.net/a772304419/article/details/133501253
今日推荐
周排行