Hello.

I have a model that draws info from another class, so basically a
ManyToMany field and want to display this information in my template.

in my models.py I have the following.

MODELS.PY

class Geo(models.Model):
    title = models.CharField(max_length=30)

class Specie(models.Model):
    geo_location = models.ManyToManyField(Geo)

VIEWS.PY
    ........
    latest_animals = Specie.objects.all()
    countries = latest_animals.geo_location_set.all()
    context = { 'latest_animals': latest_animals, 'countries':
countries, }
    ........

TEMPLATE FILE
    {% for country in countries.all %}
        <li>{{ country }}</li>
    {% endfor %}

What I really want is to display the country information which
contains multiple items that were selected.

Can anybody help me with this one?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to