From 1457eb9323363108979b3cae92b7503582df0138 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 2 Apr 2014 15:48:00 +0200 Subject: [PATCH] Django 1.6 --- contact/admin.py | 2 +- contact/forms.py | 11 ++++++--- contact/urls.py | 2 +- prawokultury/settings.d/30-apps.py | 4 ++-- prawokultury/settings.d/40-auth.py | 2 +- prawokultury/settings.d/40-middleware.py | 1 - prawokultury/settings.d/50-contrib.py | 7 ++++-- prawokultury/templates/base.html | 4 ++-- requirements.txt | 30 +++++++++++------------- 9 files changed, 34 insertions(+), 29 deletions(-) diff --git a/contact/admin.py b/contact/admin.py index 3776fc4..ee1623d 100644 --- a/contact/admin.py +++ b/contact/admin.py @@ -7,7 +7,7 @@ from django.template import Template from django.utils.safestring import mark_safe -class ContactAdminMeta(admin.ModelAdmin.__metaclass__): +class ContactAdminMeta(admin.ModelAdmin.__class__): def __getattr__(cls, name): if name.startswith('admin_list_'): return lambda self: "" diff --git a/contact/forms.py b/contact/forms.py index d2df1f7..142d209 100644 --- a/contact/forms.py +++ b/contact/forms.py @@ -1,7 +1,8 @@ from django.contrib.sites.models import Site +from django.core.exceptions import ValidationError from django.core.files.uploadedfile import UploadedFile from django.core.mail import send_mail, mail_managers -from django.core.validators import email_re +from django.core.validators import validate_email from django import forms from django.template.loader import render_to_string from django.template import RequestContext @@ -11,7 +12,7 @@ from .models import Attachment, Contact contact_forms = {} admin_list_width = 0 -class ContactFormMeta(forms.Form.__metaclass__): +class ContactFormMeta(forms.Form.__class__): def __new__(cls, *args, **kwargs): global admin_list_width model = super(ContactFormMeta, cls).__new__(cls, *args, **kwargs) @@ -68,7 +69,11 @@ class ContactForm(forms.Form): mail_managers(mail_managers_subject, mail_managers_body, fail_silently=True) - if email_re.match(contact.contact): + try: + validate_email(contact.contact) + except ValidationError: + pass + else: mail_subject = render_to_string([ 'contact/%s/mail_subject.txt' % self.form_tag, 'contact/mail_subject.txt', diff --git a/contact/urls.py b/contact/urls.py index de72e82..7f8d4c4 100644 --- a/contact/urls.py +++ b/contact/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls.defaults import * +from django.conf.urls import patterns, url from . import views urlpatterns = patterns('contact.views', diff --git a/prawokultury/settings.d/30-apps.py b/prawokultury/settings.d/30-apps.py index 374cd3c..5e2abf4 100644 --- a/prawokultury/settings.d/30-apps.py +++ b/prawokultury/settings.d/30-apps.py @@ -9,7 +9,7 @@ INSTALLED_APPS = ( 'chunks', 'sponsors', - 'gravatar', + 'django_gravatar', 'south', 'django.contrib.comments', 'django_comments_xtd', @@ -17,7 +17,7 @@ INSTALLED_APPS = ( 'haystack', 'pagination', 'sorl.thumbnail', - 'piwik.django', + 'piwik', 'django_cas', 'django.contrib.auth', diff --git a/prawokultury/settings.d/40-auth.py b/prawokultury/settings.d/40-auth.py index 675db9d..14847ac 100644 --- a/prawokultury/settings.d/40-auth.py +++ b/prawokultury/settings.d/40-auth.py @@ -1,5 +1,5 @@ if 'django_cas' in INSTALLED_APPS: AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', - 'django_cas.backends.CASBackend', + 'fnpdjango.auth_backends.AttrCASBackend', ) diff --git a/prawokultury/settings.d/40-middleware.py b/prawokultury/settings.d/40-middleware.py index 530e34a..e55f98a 100644 --- a/prawokultury/settings.d/40-middleware.py +++ b/prawokultury/settings.d/40-middleware.py @@ -15,7 +15,6 @@ if 'django_cas' in INSTALLED_APPS: MIDDLEWARE_CLASSES += ( 'django.contrib.messages.middleware.MessageMiddleware', - 'piwik.django.middleware.PiwikMiddleware', # Uncomment the next line for simple clickjacking protection: # 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'pagination.middleware.PaginationMiddleware', diff --git a/prawokultury/settings.d/50-contrib.py b/prawokultury/settings.d/50-contrib.py index 97aa2f3..61c2ed0 100644 --- a/prawokultury/settings.d/50-contrib.py +++ b/prawokultury/settings.d/50-contrib.py @@ -13,8 +13,11 @@ THUMBNAIL_QUALITY = 95 GRAVATAR_DEFAULT_IMAGE = 'http://localhost:8000/static/img/avatar.png' -CAS_SERVER_URL = 'http://logowanie.nowoczesnapolska.org.pl/cas/' -CAS_VERSION = '1' +CAS_SERVER_URL = 'https://logowanie.nowoczesnapolska.org.pl/cas/' +CAS_VERSION = '3' SPONSORS_THUMB_HEIGHT = None + +PIWIK_URL = '' +PIWIK_SITE_ID = 0 diff --git a/prawokultury/templates/base.html b/prawokultury/templates/base.html index 7b5a4b0..80d162c 100755 --- a/prawokultury/templates/base.html +++ b/prawokultury/templates/base.html @@ -1,10 +1,10 @@ -{% load url from future %} {% load i18n %} {% load static from staticfiles %} {% load fnp_common migdal_tags fnp_share fnp_lang menu_tags %} {% load sponsor_tags %} {% load compressed %} +{% load piwik_tags %} {% block "titleextra" %}{% endblock %}CopyCamp @@ -93,6 +93,6 @@ {% compressed_js 'base' %} - {{ piwik_tag|safe }} + {% tracking_code %} diff --git a/requirements.txt b/requirements.txt index 005a2d9..0b8887a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,31 +1,29 @@ -Django>=1.4,<1.5 -#django_cas --e hg+https://bitbucket.org/cpcc/django-cas@197f156ee943#egg=django_cas +-i http://pypi.nowoczesnapolska.org.pl/simple + +Django>=1.6,<1.7 +fnpdjango +django_cas>=2.1,<2.2 South>=0.7.4 PIL sorl-thumbnail>=11.09,<12 django-pagination +django-migdal>=0.4,<0.5 +pytz --e git+git://github.com/fnp/fnpdjango.git@9a5b05c52311da4f726fec29d8be7d173f695352#egg=fnpdjango --e git+git://github.com/fnp/django-migdal.git@734cd58d3f12c5397b42c1ae122c947500386014#egg=django-migdal - -#django-jsonfield --e git+git://github.com/bradjasper/django-jsonfield.git@2f427368ad70bf8d9a0580df58ec0eb0654d62ae#egg=django-jsonfield - --e git+git://github.com/fnp/django-migdal.git@734cd58d3f12c5397b42c1ae122c947500386014#egg=django-migdal +jsonfield>=0.9.20 textile -django-markupfield<1.1 # 1.1 wants Django-1.5 -django-gravatar -django_comments_xtd +django-markupfield>=1.2,<1.3 +django-gravatar2 +django-comments-xtd>=1.2,<1.3 django-pipeline>=1.2,<1.3 #pyScss #git+git://github.com/Kronuz/pyScss.git@d8f4da23a3c87696a75b3830ed4ab49b75550a93#egg=pyScss #TODO: pyScss support, for now just install sass --e git+https://github.com/toastdriven/django-haystack.git@master#egg=django-haystack +django-haystack>=2.1,<2.2 pysolr -piwik +django-piwik --e git+https://github.com/fnp/django-sponsors.git@master#egg=django-sponsors +django-sponsors -- 2.20.1