Merge branch 'master' into ocr_cleanup

This commit is contained in:
Roberto Rosario
2011-04-07 11:28:27 -04:00
3 changed files with 58 additions and 23 deletions

View File

@@ -9,7 +9,7 @@
<meta http-equiv="Content-Language" content="{{ LANGUAGE_CODE }}" />
<title>{% block html_title %}{% endblock %}</title>
{% block keywords %}{% endblock %}
{% block web_theme_head %}{% endblock %}
<link rel="stylesheet" href="{{ MEDIA_URL }}web_theme_media/stylesheets/base.css" type="text/css" media="screen" />
<link rel="stylesheet" id="current-theme" href="{{ MEDIA_URL }}web_theme_media/stylesheets/themes/{{ web_theme }}/style.css" type="text/css" media="screen" />
@@ -57,8 +57,7 @@
<div id="box">
{% block content_plain %}{% endblock %}
</div>
{% endif %}
{% if not user.is_anonymous %}
{% else %}
<div id="header">
<h1><a href="{% url home %}">{% block web_theme_project_name %}{% endblock %}</a></h1>
<div id="user-navigation">

View File

@@ -1,23 +1,49 @@
{% extends "web_theme_base.html" %}
{% load i18n %}
{% load theme_tags %}
{% block web_theme_head %}
{% if not user.is_anonymous %}
{% get_login_redirect_url %}
<meta http-equiv="REFRESH" content="5;url={{ LOGIN_REDIRECT_URL }}">
{% endif %}
{% endblock %}
{% block html_title %}{% trans "Login" %}{% endblock %}
{% block content_plain %}
<div id="box">
<h1>{% block project_name %}{% endblock %}</h1>
<div class="block" id="block-login">
<h2>{% trans "Login" %}</h2>
<div class="content login">
<form action="." method="post" class="form login">{% csrf_token %}
<div class="group wat-cf">
{% include "generic_form_instance.html" %}
<input type="hidden" name="next" value="{{ next|escape }}" />
<div class="group navform wat-cf">
<button class="button" type="submit">
<img src="{{ MEDIA_URL }}web_theme_media/images/icons/key.png" alt="Save" /> Login
</button>
</div>
</form>
{% if not user.is_anonymous %}
{% block web_theme_content %}
{% get_login_redirect_url %}
<div class="content">
<h2 class="title">{% trans "You are already logged in" %}</h2>
<div class="inner">
<p>
{% trans "Redirecting you to the website entry point in 5 seconds." %}
<p>
</p>
{% blocktrans %}Or click <a href="{{ LOGIN_REDIRECT_URL }}">here</a> if redirection doesn't work.{% endblocktrans %}
</p>
</div>
</div>
</div>
{% endblock %}
{% endblock %}
{% else %}
{% block content_plain %}
<div id="box">
<h1>{% block project_name %}{% endblock %}</h1>
<div class="block" id="block-login">
<h2>{% trans "Login" %}</h2>
<div class="content login">
<form action="." method="post" class="form login">{% csrf_token %}
<div class="group wat-cf">
{% include "generic_form_instance.html" %}
<input type="hidden" name="next" value="{{ next|escape }}" />
<div class="group navform wat-cf">
<button class="button" type="submit">
<img src="{{ MEDIA_URL }}web_theme_media/images/icons/key.png" alt="Save" /> Login
</button>
</div>
</form>
</div>
</div>
</div>
{% endblock %}
{% endif %}

View File

@@ -1,4 +1,5 @@
import types
import re
from django.conf import settings
from django.core.urlresolvers import reverse, NoReverseMatch
@@ -22,8 +23,6 @@ class GetThemeNode(Node):
return ''
import re
@register.tag
def get_theme(parser, token):
try:
@@ -42,3 +41,14 @@ def get_theme(parser, token):
#if not (format_string[0] == format_string[-1] and format_string[0] in ('"', "'")):
# raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name
return GetThemeNode(var_name)
class LoginRedirectNode(Node):
def render(self, context):
context['LOGIN_REDIRECT_URL'] = getattr(settings, 'LOGIN_REDIRECT_URL', '/')
return ''
@register.tag
def get_login_redirect_url(parser, token):
return LoginRedirectNode()