From ab313a2a66e29e83ef921421be107ad9034fc787 Mon Sep 17 00:00:00 2001
From: Jan Dittberner
Date: Sat, 17 Jan 2015 17:50:59 +0100
Subject: [PATCH] add allauth configuration and message tags
---
gnuviechadmin/gnuviechadmin/settings/base.py | 16 +++++++++++++++-
gnuviechadmin/templates/base.html | 12 ++++++++++--
gnuviechadmin/templates/dashboard/index.html | 2 +-
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/gnuviechadmin/gnuviechadmin/settings/base.py b/gnuviechadmin/gnuviechadmin/settings/base.py
index 29ebe88..913c1cd 100644
--- a/gnuviechadmin/gnuviechadmin/settings/base.py
+++ b/gnuviechadmin/gnuviechadmin/settings/base.py
@@ -10,6 +10,7 @@ from sys import path
# Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception.
from django.core.exceptions import ImproperlyConfigured
+from django.contrib.messages import constants as messages
def get_env_variable(var_name):
@@ -247,7 +248,6 @@ ALLAUTH_APPS = (
'allauth.socialaccount',
'allauth.socialaccount.providers.google',
'allauth.socialaccount.providers.linkedin_oauth2',
- 'allauth.socialaccount.providers.openid',
'allauth.socialaccount.providers.twitter',
'allauth.socialaccount.providers.xing',
)
@@ -266,9 +266,23 @@ LOCAL_APPS = (
# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
INSTALLED_APPS = DJANGO_APPS + ALLAUTH_APPS + LOCAL_APPS
+
+MESSAGE_TAGS = {
+ messages.DEBUG: '',
+ messages.ERROR: 'text-danger',
+ messages.INFO: 'text-info',
+ messages.SUCCESS: 'text-success',
+ messages.WARNING: 'text-warning',
+}
########## END APP CONFIGURATION
+########## ALLAUTH CONFIGURATION
+LOGIN_REDIRECT_URL = '/'
+SOCIALACCOUNT_QUERY_EMAIL = True
+########## END ALLAUTH CONFIGURATION
+
+
########## CRISPY FORMS CONFIGURATION
CRISPY_TEMPLATE_PACK = 'bootstrap3'
########## END CRISPY_FORMS CONFIGURATION
diff --git a/gnuviechadmin/templates/base.html b/gnuviechadmin/templates/base.html
index 1193943..0565c8e 100644
--- a/gnuviechadmin/templates/base.html
+++ b/gnuviechadmin/templates/base.html
@@ -51,9 +51,9 @@
{% if user.is_authenticated %}
{% trans "My Profile" %}
{% if user.is_staff %}{% trans "Admin site" %}{% endif %}
- {% trans "Logout" %}
+ {% trans "Logout" %}
{% else %}
- {% trans "Sign In" %}
+ {% trans "Sign In" %}
{% endif %}
@@ -64,6 +64,14 @@
{% block page_title %}Example Base Template{% endblock page_title %}
+ {% if messages %}
+
+ {% for message in messages %}
+ - {{ message }}
+ {% endfor %}
+
+ {% endif %}
+
{% block content %}
Use this document as a way to quick start any new project.
{% endblock content %}
diff --git a/gnuviechadmin/templates/dashboard/index.html b/gnuviechadmin/templates/dashboard/index.html
index fb00db6..6b435eb 100644
--- a/gnuviechadmin/templates/dashboard/index.html
+++ b/gnuviechadmin/templates/dashboard/index.html
@@ -9,6 +9,6 @@ You can visit your Dashboard to view and modif
{% endblocktrans %}
{% else %}
{% trans "This is your entry to our customer self service sytem." %}
-{% url 'login' as login_url %}{% url 'dashboard' as dashboard_url %}{% blocktrans %}If you are already a customer you can Sign in to view and modify your hosting options.{% endblocktrans %}
+{% url 'account_login' as login_url %}{% url 'dashboard' as dashboard_url %}{% blocktrans %}If you are already a customer you can Sign in to view and modify your hosting options.{% endblocktrans %}
{% endif %}
{% endblock content %}