Paolo
Paolo

Reputation: 361

Get all table data in Django

I'm trying to access into a Database data through a Django view. The problem is that when I query it, it just returns me the result of the unicode function on the model. How can I access to the other fields of the model?

Thanks!

Upvotes: 10

Views: 27440

Answers (1)

Aswin Murugesh
Aswin Murugesh

Reputation: 11070

say you have a student database,

student_list = Student.objects.all()
for student in student_list:
    print student.name

The other fields can be used in the iterator, using the dot(.) operator

Upvotes: 23

Related Questions