Hi,

I've a model testDB with a foreignkey "country" related to another database.

I need to retrieve the unique value of country.common_name.

With this

country_list = testDB.objects.values('country').distinct

I can retrieve the unique value, but only the ID.

In [63]: testDB.objects.values('country').distinct
Out[63]: <bound method ValuesQuerySet.distinct of [{'country': 0L},
{'country': 0L}, {'country': 0L}, {'country': 0L}, {'country': 0L},
{'country': 0L}, {'country': 0L}, {'country': 0L}, {'country': 0L},
{'country': 0L}, {'country': 0L}, {'country': 0L}, {'country': 0L},
{'country': 0L}, {'country': 0L}, {'country': 0L}, {'country': 0L},
{'country': 0L}, {'country': 0L}, {'country': 0L}, '...(remaining
elements truncated)...']>

How can I  retrieve the attribute "common_name" of the country object?


thanks in advance,

Alfredo

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to