I'm getting, what seems to me, an inconsistency.
Here's a simplified example:
>>qs=Mymodel.objects.all()
>>for i in qs:
setattr(i,"firstname","merric")
This works on:-
>>qs[0].firstname
>>merric
It also works in the template:-
{% for i in qs %} {{ i.firstname }} {% endfor %}
so I don't understand why this doesn't seem to work after I've set the
new attribute:-
>> for i in qs:
print i.name
>> Attribute Error 'QuerySet' object has no attribute 'merric'.
Am I doing something fundamentally wrong? If not this seems rather
inconsistent. If I can iterate through an altered QuerySet in my
template why can't I do
so in the code?
My problem is this:-
I have a query set that I need to filter, but only after I've done a
bunch of dynamic calculations on other related data. Is there an easy
way to alter the query set dynamically and effectively?
Thanks
MerMer
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---