I have an app that makes use of 'django-registration' a custom built model named 'idea' and also a 'userprofile'
Now the Idea class looks as follows
class Idea(models.Model):
title = ...
user = models.ForeignKey(User)
The User class is Django's Auth User system.
And the UserProfile looks as follow.
class UserProfile(ImageModel):
user = models.ForeignKey(User)
image = models.ImageField(.....)
Now lets say in my frontpage I want to display all Idea and have the user and his "avatar" to display.
How do I associate all three models without having to render it through the Context.
{% for ideas in idea %}
{{ idea.user.get_full_name }} just posted an idea with the name of {{ idea.title }}
{% endofr %}
Now I would like to display the users profile pic in this too.
Best I can come up with is
{% for userprofile in idea.user_set.all %}
img src="{{ userprofile.image }}"
{% endfor %}