Try

name = [name.encode("utf8") for name in Staff.objects.filter(id = 
3).values_list('user_name', *flat=True*)]

The other returns one-tuples in a list

https://docs.djangoproject.com/en/dev/ref/models/querysets/#values-list

K

On Sunday, May 25, 2014 7:55:51 PM UTC-7, hito koto wrote:
>
> Hi,
> I want to encode in utf8 but don't know how can i to ?
>
> i have the errors is here:
>
> AttributeError: 'tuple' object has no attribute 'encode'
>
> My code is here :
>  name = [name.encode("utf8") for name in Staff.objects.filter(id = 
> 3).values_list('user_name')]
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/857b95a3-4c38-4a0a-9231-211fe6f2757f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to