hi all

I have a model like this (I intentionally replaced the details by
dots):

class Family(...):
   name = ... # field contains non-unique values
   age = ...
   # model method to get children, here operations with another model
are involved
   def getChildren():
         return ...

when I prepare data for custom view, I need to process like like this:

def old(request):
   a = Family.objects.filter(age__gt=50)
   # then I need to apply getChildren() to all members of queryset a
   # the most the easiest way is
   b = [m.getChildren() for m in a]
   # then I pass it to template

the questions are:
1. is it efficient way?
2. is it better for performance to send queryset to template? it does
it matter?
3. if "yes" to 2nd question, how to form such queryset, taking into
account need to execute model method?
4. if b contain non-unique values and I want to use .distinct()
method, how to create a queryset instead of list?


--~--~---------~--~----~------------~-------~--~----~
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