开发者

Django Model data incomplete

I have a model with 6 fields, but when I access them using the author field and print the result, it only displays 4 of them, field5 is not shown. The admin shows all fields. My view, model and modelform are below.

if request.P开发者_如何学运维OST:
    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',)

The output is Field1 Field2 Field3 Field4


it seems that the output is simply the unicode defined. The individual fields can still be accessed using c1.fieldname

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜