On 8 déc, 08:53, Sotiris Kazakis <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Thank you for your answer.
>
> I try : tbData = tableName.objects.values(*strFld.split(","))
>
> but that error appears :
>
>   File "/var/lib/python-support/python2.4/django/db/models/sql/query.py", 
> line 1503, in add_fields
>     field, target, u2, joins, u3, u4 = self.setup_joins(
> AttributeError: 'list' object has no attribute 'split'
> because strFld.split(",") --> produce a list

>>> fnames=['target_user', 'source_user']
>>> Friendship.objects.values(*fnames)
[{'source_user': 1L, 'target_user': 2L}]
>>> fields = "target_user,source_user"
>>> Friendship.objects.values(*fields.split(','))
[{'source_user': 1L, 'target_user': 2L}]
>>>

str.split() indeed returns a list, but that's obviously not the cause
of your problem here.



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to