I was not enough precise..
'Story' object has a method get_main_section...

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

in my template I have : {{ story.get_main_section }}

..sorry..
Davide


On 3 Set, 16:36, krylatij <[EMAIL PROTECTED]> wrote:
> it seems you need extra select anyway
> or use .extra(...) to add additional args to db query
> (http://www.djangoproject.com/documentation/db-api/#extra-select-none-
> where-none-params-none-tables-none-order-by-none-select-params-none)
>
> But i don't understand. Imagine we have Story with 3 Sections
> And in template we access this sections via
> {{ my_simple_story.id_section.section_name }}
> Which section_name (we have 3 Sections) you want to display in this
> template?
>
> It seem's you need another syntax like:
> {% for section in my_simple_story.id_section %}
>      {{ section.section_name}} <br/>
> {% endfor %}
--~--~---------~--~----~------------~-------~--~----~
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