title: Changing a visitor permission using Django Sessions
body: <p>I have a Django application with a number of polls. There is no option to register on my website as a user. I want to allow a visitor to vote on a specific poll only once every seven days.</p>
  
  <p>This is how I am changing the visitor permission in my <strong>ajax.py</strong> file</p>
  
  <pre><code>@dajaxice_register
  def update_disable(request, song_pk):
      #update votes
      request.session['has_voted'] = True
      request.session.set_expiry(timezone.now() + timedelta(days=7))
      return dajax.json()
  </code></pre>
  
  <p>This is how I'm disabling the button in my template</p>
  
  <pre><code>{% if perms.hunt.has_voted %}
      &lt;button type="button" class="btn btn-default" disabled="disabled"&gt;
        Vote as Favourite
      &lt;/button&gt;
  {% else %}
      &lt;button type="button" class="btn btn-default" onclick="update(this);"&gt;
        Vote as Favourite
      &lt;/button&gt;
  {% endif %}
  </code></pre>
  
  <p>But even after voting my code goes to the else part in the template. What's wrong here?</p>