views:

21

answers:

1

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.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',)

The output is Field1 Field2 Field3 Field4

A: 

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

Ali