I still think you need second query.
as i understand from your code get_main_section will return list of
Sections in Story?
I mean this string:
(section_name = self.id_section.all().order_by('order') )

bad:
 if (len(self.id_section.all()) > 1):    #hits DB
         section_name = self.id_section.all().order_by('order') #hits
DB

better:
sections = self.id_section.all()
if (len(sections) > 1):
     ............



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