Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango template tag + template with user.is_authenticated doesn't work
    text
    copied!<p>I have a strange problem, in my settings file everything is enabled that needs to be enabled for user.is_authenticated use in a template.</p> <p>I have the following template tag code:</p> <pre><code>from django import template from progmatic.cms.models import navigation, navigation_item from django.template.defaultfilters import slugify from django.shortcuts import render_to_response from django.template import RequestContext register = template.Library() """ Gets the menu items you have entered in the admin. No arguments are accpeted""" def get_hoofd_menu( ): menu = navigation.objects.get( slug = "hoofd-menu"); mcontent = navigation_item.objects.filter( parent_menu = menu); return { 'mcontent' : mcontent } def get_sub_menu( menu ): menu = navigation.objects.get( slug = slugify(menu) ) mcontent = navigation_item.objects.filter( parent_menu = menu ) c = RequestContext( request, { 'mcontent': mcontent,} ) return render_to_reponse('menu.html', RequestContext(request, { 'mcontent' : mcontent }) ) register.inclusion_tag('menu.html')( get_hoofd_menu ) register.inclusion_tag('menu.html')( get_sub_menu ) </code></pre> <p>And the template (menu.html) is as follows:</p> <pre><code>{% block mainmenu %} &lt;ul&gt; {% for content in mcontent %} {% if content.login_required %} {% if content.to_page %} &lt;li&gt;&lt;a href="/page/{{ content.to_page_slug }}"&gt;{{ content.name }}&lt;/a&gt;&lt;/li&gt; {% endif %} {% if content.to_url %} {% if content.external %} &lt;li&gt;&lt;a href="{{ content.to_url }}" rel="external"&gt;{{ content.name }}&lt;/a&gt;&lt;/li&gt; {% else %} &lt;li&gt;&lt;a href="{{ content.to_url }}"&gt;{{ content.name }}&lt;/a&gt;&lt;/li&gt; {% endif %} {% endif %} {% else %} {% if content.to_page %} &lt;li&gt;&lt;a href="/page/{{ content.to_page_slug }}"&gt;{{ content.name }}&lt;/a&gt;&lt;/li&gt; {% endif %} {% if content.to_url %} {% if content.external %} &lt;li&gt;&lt;a href="{{ content.to_url }}" rel="external"&gt;{{ content.name }}&lt;/a&gt;&lt;/li&gt; {% else %} &lt;li&gt;&lt;a href="{{ content.to_url }}"&gt;{{ content.name }}&lt;/a&gt;&lt;/li&gt; {% endif %} {% endif %} {% endif %} {% endfor %} &lt;/ul&gt; {% if user.is_authenticated %} JEEEEEEEJ LOGGED IN {% else %} Not logged in {% endif %} {% endblock %} </code></pre> <p>But it always returns Not logged in even when i am logged in... Does anybody has a clue what is wrong with this code?</p> <p>Thanks in advance.</p> <p>Greetings, Bloeper</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload