hi,
i have a question about retrieving related objects avoiding double entries.
actually i have 3 models:
topics
projects
technologies
the projects model has foreignkeys to topics and technologies. i have a
view for the topic detail like this:
def topic_detail(request, slug):
topic = get_object_or_404(Topic, slug=slug)
return object_list(request,
queryset=topic.project_set.all(),
paginate_by=20,
template_name='FSlabs/topic_detail.html',
extra_context={ 'topic': topic })
in the template i can loop trough the projects and get those assigned
to this topic.
but im having problems to retrieve the technologies used by those
projects without having double entries.
i tried this in the template with a list for every project
assigned...which of course is not what i want:
{% for project in object_list %}
{% for technology in project.technologies.distinct %}
<a href="{{ technology.get_absolute_url }}">{{
technology.title }}</a>
{% if forloop.last %}{% else %}
{% ifequal forloop.revcounter0 1 %}and {% else %}, {%
endifequal %}
{% endif %}
{% endfor %}
{% endfor %}
can somebody point me to the right way to get what i need?
thx
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
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.