Tuesday, January 21, 2014

Re: displaying manytomany fields in template

You will need to provide the Person model to decipher what is going on in your template. 

On Tuesday, 21 January 2014 17:34:00 UTC+11, splucena wrote:


Template:
  
 {% for per in person_list%}
    <tr>
    <td>{{ per }}</td>
    {% for spec in per.specialization_id.all %}
        <td>{{ spec }}</td>
    {% endfor %}
    </tr>
    {% endfor %}

Here's my code in the template. I'ts not doing what I intend to see.

The table looks like this:

FullName | Programming | Web Design

How can I make it look like this instead

FullName | Programming, Web Design |

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cae822f2-aa97-4999-9629-c6c345a3a6e3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate