parent
9550feae40
commit
4c1b2b0f6a
|
@ -1,3 +1,5 @@
|
|||
from collections import defaultdict
|
||||
|
||||
from pkg_resources import get_distribution
|
||||
from django.conf import settings
|
||||
|
||||
|
@ -38,4 +40,5 @@ def a2_processor(request):
|
|||
else:
|
||||
__AUTHENTIC2_DISTRIBUTION = str(get_distribution('authentic2'))
|
||||
variables['AUTHENTIC2_VERSION'] = __AUTHENTIC2_DISTRIBUTION
|
||||
variables['add_to_blocks'] = defaultdict(lambda:[])
|
||||
return variables
|
||||
|
|
|
@ -52,7 +52,6 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
|||
'django.contrib.messages.context_processors.messages',
|
||||
'django.core.context_processors.static',
|
||||
'authentic2.context_processors.a2_processor',
|
||||
'sekizai.context_processors.sekizai',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
|
@ -122,7 +121,6 @@ INSTALLED_APPS = (
|
|||
'authentic2.manager',
|
||||
'authentic2',
|
||||
'gadjo',
|
||||
'sekizai',
|
||||
)
|
||||
|
||||
if django.VERSION < (1,7):
|
||||
|
|
|
@ -1,10 +1,19 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n sekizai_tags gadjo %}
|
||||
{% load i18n gadjo authentic2 %}
|
||||
|
||||
{% block title %}
|
||||
{% trans "Log in" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
<link rel="stylesheet" href="{{ STATIC_URL }}jquery/css/jquery-ui.custom.css" />
|
||||
<link rel="stylesheet" href="{{ STATIC_URL }}ulx/css/ulx.css" />
|
||||
<script type="text/javascript" src="{% xstatic 'jquery' 'jquery.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% xstatic 'jquery-ui' 'jquery-ui.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{{ STATIC_URL }}jquery/js/jquery.cookie.js"></script>
|
||||
<script type="text/javascript" src="{{ STATIC_URL }}jquery/js/jquery.simplemodal.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
|
@ -23,10 +32,4 @@
|
|||
<script type="text/javascript">
|
||||
$( "#tabs" ).tabs({cookie: {path: '/'}});
|
||||
</script>
|
||||
{% addtoblock "css" %}<link rel="stylesheet" href="{{ STATIC_URL }}jquery/css/jquery-ui.custom.css" />{% endaddtoblock %}
|
||||
{% addtoblock "css" %}<link rel="stylesheet" href="{{ STATIC_URL }}ulx/css/ulx.css" />{% endaddtoblock %}
|
||||
{% addtoblock "js" %}<script type="text/javascript" src="{% xstatic 'jquery' 'jquery.min.js' %}"></script>{% endaddtoblock %}
|
||||
{% addtoblock "js" %}<script type="text/javascript" src="{% xstatic 'jquery-ui' 'jquery-ui.min.js' %}"></script>{% endaddtoblock %}
|
||||
{% addtoblock "js" %}<script type="text/javascript" src="{{ STATIC_URL }}jquery/js/jquery.cookie.js"></script>{% endaddtoblock %}
|
||||
{% addtoblock "js" %}<script type="text/javascript" src="{{ STATIC_URL }}jquery/js/jquery.simplemodal.js"></script>{% endaddtoblock %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% load i18n sekizai_tags staticfiles %}
|
||||
{% load i18n authentic2 staticfiles %}
|
||||
<div>
|
||||
<form method="post" action="">
|
||||
{% csrf_token %}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n sekizai_tags gadjo %}
|
||||
{% load i18n gadjo %}
|
||||
|
||||
|
||||
{% block title %}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
{% load i18n sekizai_tags%}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
{% load i18n authentic2 %}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="{{ STATIC_URL }}authentic2/css/style.css" />
|
||||
{% render_block "css" %}
|
||||
<title>{% block title %}User test{% endblock %}</title>
|
||||
{% block extra_scripts %}
|
||||
{% renderblock "css" %}
|
||||
{% renderblock "js" %}
|
||||
{% endblock %}
|
||||
{% render_block "js" %}
|
||||
</head>
|
||||
|
||||
<body {% block bodyargs %}{% endblock %} >
|
||||
|
@ -51,7 +51,9 @@
|
|||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
{% render_block "js-endpage" %}
|
||||
{% block js-endpage %}
|
||||
{% renderblock "js-endpage" %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.tag('addtoblock')
|
||||
def addtoblock(parser, token):
|
||||
try:
|
||||
tag_name, block_name = token.split_contents()
|
||||
except ValueError:
|
||||
raise template.TemplateSyntaxError(
|
||||
'%r tag requires a single argument' % token.contents.split()[0])
|
||||
if not (block_name[0] == block_name[-1] and block_name[0] in ('"', "'")):
|
||||
raise template.TemplateSyntaxError(
|
||||
'%r tag requireds its argument to be quoted' % tag_name)
|
||||
nodelist = parser.parse(('endaddtoblock',))
|
||||
parser.delete_first_token()
|
||||
return AddToBlock(block_name, nodelist)
|
||||
|
||||
|
||||
class AddToBlock(template.Node):
|
||||
def __init__(self, block_name, nodelist):
|
||||
self.block_name = block_name[1:-1]
|
||||
self.nodelist = nodelist
|
||||
|
||||
def render(self, context):
|
||||
output = self.nodelist.render(context)
|
||||
dest = context['add_to_blocks'][self.block_name]
|
||||
if output not in dest:
|
||||
dest.append(output)
|
||||
return ''
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def renderblock(context, block_name):
|
||||
output = u'\n'.join(context['add_to_blocks'][block_name])
|
||||
return output
|
Loading…
Reference in New Issue