kopia lustrzana https://github.com/rtts/django-simplecms
Even better permissions. Seems that they get swapped automatically!
rodzic
d5bbfb67cf
commit
09f03b6866
|
@ -29,7 +29,7 @@
|
|||
{% for p in pages %}
|
||||
<li><a href="{% if p.slug %}{% url 'cms:page' p.slug %}{% else %}{% url 'cms:page' %}{% endif %}" {% if p.pk == page.pk %}class="current"{% endif %}>{{p.title}}</a></li>
|
||||
{% endfor %}
|
||||
{% if user.is_staff %}
|
||||
{% if perms.cms_page_create %}
|
||||
<li><a class="edit" href="{% url 'cms:createpage' %}">+ {% trans 'new page' %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
|
|
@ -14,12 +14,17 @@ class IncludeSectionNode(template.Node):
|
|||
def __init__(self, section):
|
||||
self.section = template.Variable(section)
|
||||
self.csrf_token = template.Variable('csrf_token')
|
||||
self.perms = template.Variable('perms')
|
||||
super().__init__()
|
||||
|
||||
def render(self, context):
|
||||
section = self.section.resolve(context)
|
||||
template_name = section.view.template_name
|
||||
csrf_token = self.csrf_token.resolve(context)
|
||||
section.context.update({'csrf_token': csrf_token})
|
||||
perms = self.perms.resolve(context)
|
||||
section.context.update({
|
||||
'csrf_token': csrf_token,
|
||||
'perms': perms,
|
||||
})
|
||||
t = context.template.engine.get_template(template_name)
|
||||
return t.render(template.Context(section.context))
|
||||
|
|
Ładowanie…
Reference in New Issue