Django:如何列出表单中的所有数据库条目(类似于管理列表索引页面),每个条目都有一个可以更改的下拉字段(查看)。下拉列表(查看字段)从数据库中读取存储的值。 当下拉值更改时,会自动保存到该条目。我无法正确生成views.py和表单
REVIEW_CHOICES = (
('Not-Rev', 'Not Reviewed'),
('Rev-NA', 'Reviewed Accepted')
)
`class Articles(models.Model):
title = models.CharField(max_length=100, blank=True, null=False)
review = models.CharField(max_length =30, default=REVIEW_CHOICES[0], choices=REVIEW_CHOICES)`
class ReviewForm(forms.Form):
review = forms.ModelChoiceField(queryset=articles.objects.all(), to_field_name = 'review', required=False)
class Meta:
model = articles
fields = [
'title', 'review'
]