title: Display Profile Picture of Users
body: <p>I am trying to display the profile pictures of new users registered to a website to show to every user logged onto the website and so far i have been able to display their username but i am having difficulty displaying their profile picture stored in an extended model User profile. How do i make this happen to display it in my templates. A better solution is welcome </p>
  
  <pre><code>Profile_tag
  
  def person(context, e):
      """
      Renders a single user object.
      """
      to_return = {
          'user': context ['user'],
          'profile': context['UserProfile.objects.all'],
  
      }
  
  register = template.Library()
  register.inclusion_tag('profile/person.html', takes_context=True)(person)
  
  Person.html
  
  
  &lt;div class="person"&gt;
      &lt;a href="{% url 'profile_detail' user.username %}"&gt;
          &lt;span class="username"&gt;{{ user.username|slice:"12" }}&lt;/span&gt;
          &lt;p&gt; &lt;img src="/static/assets/{{profile_picture}}"  height="100" width="100"&gt;&lt;/p&gt;
  
      &lt;/a&gt;
  &lt;/div&gt;
  
  
  user_list.html
  
  {% load profile_tags %}
  {% block main_content %}
      &lt;h1&gt;Newest Users&lt;/h1&gt;
      {% friends_for_user user as friend_dict %}
      {% for person in object_list %}
          {% dict_entry_for_item person.username from friend_dict as friend %}
  
              {% person person %}
              {% ifnotequal person user %}
                  &lt;form method="POST" action="{% if friend %}{% url 'sg_unfollow' person.username %}{% else %}{% url 'sg_follow' person.username %}{% endif %}"&gt;{%csrf_token%}
  
                      &lt;input type="submit" value="{% if friend %}Unfollow{% else %}Follow{% endif %}" /&gt;
                  &lt;/form&gt;
              {% endifnotequal %}
  
  
          {% endfor %}
  
  Urls.py
  
  urlpatterns = patterns('profile.views',
      url(r'^detail/(?P&lt;username&gt;[a-zA-Z0-9_-]+)/$', 'detail', 
          name='profile_detail'),
  )
  </code></pre>