0
我有6個字段的模型,但是當我使用作者字段訪問它們並打印結果時,它只顯示4個字段,field5未顯示。管理員顯示所有字段。下面是我的觀點,模型和模型。Django模型數據不完整
if request.POST:
c1 = Datastore.objects.get(author = request.user)
return HttpResponse(c1)
class Datastore(models.Model):
field1 = models.CharField(max_length=100, verbose_name = "")
field2 = models.IntegerField(verbose_name = "")
field3 = models.IntegerField(blank=True, null=True,verbose_name="")
field4 = models.IntegerField(blank=True, null=True, verbose_name = "")
field5 = models.IntegerField(default = 0)
author = models.ForeignKey(User)
class Datastoreform(ModelForm):
"""ModelForm for model: Datastore"""
class Meta:
model = Datastore
exclude = ('author',)
輸出是字段1字段2字段3字段4