I modified the 'get_main_section' method in this way..

    def get_main_section(self):
        try:
            sections = list(self.id_section.all().order_by('order'))
            if (len(sections) > 1):
                section_name = sections[1]
            else:
                section_name = sections[0]
            return section_name

But my question is:
is possibile to populate the id_section field in my Story object just
one time?
if in the same template i write:

{{ story.get_main_section }}
{{ story.get_main_section }}
{{ story.get_main_section }}

django make 3 query to mysql...
I tried with select_related, but without success.

Thanks

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