title: How to show different button in template according to user logged in in django
body: <p>I need to show different button in my template based on user's log in. The scenario is my template show follow button:</p>
  
  <pre><code>Check whether the user logged in or not-
    if user logged in-
     check which channel he follwed:
       if he followed any channel 
         beside that channel name show "followed" button
       else
         show "follow" button with the path follow_save 
    elif user not logged in:
       show follow button with the path follow_save
  </code></pre>
  
  <p>I am stuck how to do that? Is this a task for views or for template? how to do that? Any help from you experts will save me..Also I have wanted to take the user_id from session.
  Here is my views.py</p>
  
  <pre><code>e= EventArchiveGallery.objects.all()   
  user = request.session['user_id']
  if user:
      j = EventArchiveGallery()
      joining_list = j.joiningList(user)         
  
  return render_to_response('gallery/allevents.html',
  {
      'joining_list':joining_list,
  },
  context_instance=RequestContext(request)                         
  ) 
  </code></pre>
  
  <p>This is my templates:</p>
  
  <pre><code>{% for event in live %}
      &lt;p&gt;Event Title:{{event.event_title}}&lt;p/&gt;
      &lt;p&gt;Channel Name:{{event.channel_id.channel_title}}&lt;/p&gt;
      &lt;p&gt;Event Description{{event.event_description}}&lt;/p&gt;
      {% if event in joining_list %}
          &lt;p&gt;followed&lt;/p&gt;
              {%else%}
                      &lt;p&gt;follow&lt;/p&gt; #I have wanted to show follow_save function call from this button,when user clicked
              {endif%}
    {% endfor %}
  </code></pre>