Saturday, December 24, 2011

selecting single column from models

I am using sqlite3 as db and in django i want to use values from
table.

For e.g Customer table has value customer_id, customer_handle,
token_auth_key,token_sec_key.

my query in views.py is:

--------------------------------------------------------------------------------
x = Customer.objects.all()
return render_to_response('xyz.html',{ 'bb':x })
--------------------------------------------------------------------------------

in xyz.html code is:

--------------------------------------------------------------------------------
{{ bb }}
--------------------------------------------------------------------------------

When I try to use value of say token_auth_key I get following

[<Customer: Customer object>, <Customer: Customer object>]

please tell me what am I doing wrong??

I just want to select values for few columns. How to do that??

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate