Commit 06ec603a authored by Давид Ли's avatar Давид Ли

web 25

parent 23744ea8
def greetings(request):
return {'greetings': 'Hello from 25 webinar'}
......@@ -66,6 +66,7 @@ TEMPLATES = [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'core.contextprocessors.greetings'
],
},
},
......
{% extends 'base.html' %}
{% load static %}
{% load custom_tags %}
{% block content %}
<h1>Articles</h1>
<h1>{{ "Articles"|upper }}</h1>
<h1>{{ greetings }}</h1>
{% custom_range 1 10 as range %}
{% for num in range %}
{{ num }}
{% endfor %}
{% if perms.web.add_article %}
<a href="{% url 'articles-add' %}" class="btn btn-primary">Создать</a>
......
from django.template.library import Library
register = Library()
@register.filter
def upper(value):
return value.upper()
@register.simple_tag(name='custom_range')
def custom_range(a, b):
return range(a, b)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment