0
点赞
收藏
分享

微信扫一扫

Python Django 4.2.5教程:<模型类名>.objects.filter过滤查询示例


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过滤查询示例_django

Python Django 4.2.5教程:<模型类名>.objects.filter过滤查询示例_python_02


举报

相关推荐

0 条评论