Commit 501ece79 authored by Aurélien Bompard's avatar Aurélien Bompard

Raise Django version dependency to 1.8

parent 9849a79d
......@@ -26,7 +26,7 @@ Requirements
Postorius requires Python 2.6 or newer and mailman.client,
the official Python bindings for GNU Mailman, it also requires
django-social-auth.
The minimum Django version is 1.6.
The minimum Django version is 1.8.
Postorius needs a running version of GNU Mailman version 3.
......
......@@ -39,7 +39,7 @@ setup(
packages=find_packages('src'),
package_dir={'': 'src'},
include_package_data=True,
install_requires=['django>=1.6',
install_requires=['django>=1.8',
'django-browserid',
'mailmanclient']
)
......@@ -48,8 +48,7 @@ def postorius(request):
'postorius_base_template': template_to_extend,
'request': request,
'hyperkitty_url': hyperkitty_url,
# Resolve the login and logout URLs from the settings (they can be
# either URLs or view names since Django 1.6)
# Resolve the login and logout URLs from the settings
'login_url': resolve_url(settings.LOGIN_URL),
'logout_url': resolve_url(settings.LOGOUT_URL),
}
......@@ -43,18 +43,17 @@ dash:
# List all currently configured envs:
$ tox -l
py27-django1.5
py27-django1.6
py27-django1.7
py27-django18
py27-django19
# Test Django 1.7 on Python2.7 only:
$ tox -e py27-django1.7
# Test Django 1.8 on Python2.7 only:
$ tox -e py27-django18
# Run only tests in ``test_address_activation``:
$ tox -- postorius.tests.test_address_activation
# You get the idea...
$ tox -e py27-django1.7 -- postorius.tests.test_address_activation
$ tox -e py27-django18 -- postorius.tests.test_address_activation
All test modules reside in the ``postorius/src/postorius/tests``
......
......@@ -73,7 +73,7 @@ Third, prepare the database:
::
$ cd postorius_standalone
$ python manage.py syncdb
$ python manage.py migrate
$ cd ..
This will create the ``.db file`` (if you ar using SQLite) and will setup all the
......
......@@ -19,10 +19,7 @@
from django.forms import Form
from django.utils import safestring
from django.forms.forms import BoundField
try:
from django.forms.utils import ErrorList
except ImportError:
from django.forms.util import ErrorList # Django 1.6
from django.forms.utils import ErrorList
class FieldsetError(Exception):
......
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'AddressConfirmationProfile'
db.create_table(u'postorius_addressconfirmationprofile', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('email', self.gf('django.db.models.fields.EmailField')(max_length=75)),
('activation_key', self.gf('django.db.models.fields.CharField')(max_length=40)),
('created', self.gf('django.db.models.fields.DateTimeField')()),
('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
))
db.send_create_signal(u'postorius', ['AddressConfirmationProfile'])
def backwards(self, orm):
# Deleting model 'AddressConfirmationProfile'
db.delete_table(u'postorius_addressconfirmationprofile')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'postorius.addressconfirmationprofile': {
'Meta': {'object_name': 'AddressConfirmationProfile'},
'activation_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
'created': ('django.db.models.fields.DateTimeField', [], {}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"})
}
}
complete_apps = ['postorius']
\ No newline at end of file
......@@ -187,11 +187,5 @@ class TestAddressActivationLinkSuccess(ViewTestCase):
self.assertEqual(
set([a.email for a in self.mm_user.addresses]),
set(['ler@example.org', 'les@example.org']))
try:
logged_in_user = response.wsgi_request.user
except AttributeError:
# Django 1.6: the wsgi request is not available, ignore this last
# assertion.
pass
else:
self.assertEqual(logged_in_user.other_emails, ['les@example.org'])
logged_in_user = response.wsgi_request.user
self.assertEqual(logged_in_user.other_emails, ['les@example.org'])
......@@ -131,9 +131,6 @@ class ViewTestCase(TestCase):
def assertRedirectsToLogin(self, url):
response = self.client.get(url)
if DJANGO_VERSION >= (1, 8):
# Django < 1.8 did not quote "@" signs.
url = quote(url)
self.assertRedirects(response,
'{}?next={}'.format(reverse(settings.LOGIN_URL), url))
'{}?next={}'.format(reverse(settings.LOGIN_URL), quote(url)))
......@@ -241,17 +241,9 @@ def user_profile(request, user_email=None):
if request.method == 'POST':
form = AddressActivationForm(request.POST)
if form.is_valid():
# XXX Use the following when django 1.6 is dropped as a dependency
# It is more efficient because it can be done in one database operation
#
# profile, created = AddressConfirmationProfile.objects.update_or_create(
# email=form.cleaned_data['email'], user=request.user, defaults={
# 'activation_key': uuid.uuid4().hex})
try:
profile = AddressConfirmationProfile.objects.get(email=form.cleaned_data['email'], user=request.user)
profile.save()
except AddressConfirmationProfile.DoesNotExist:
profile = AddressConfirmationProfile.objects.create(email=form.cleaned_data['email'], user=request.user)
profile, created = AddressConfirmationProfile.objects.update_or_create(
email=form.cleaned_data['email'], user=request.user, defaults={
'activation_key': uuid.uuid4().hex})
try:
profile.send_confirmation_link(request)
messages.success(request,
......
[tox]
envlist = py27-django{16,17,18,19}
envlist = py27-django{18,19}
[base]
deps =
......@@ -12,8 +12,6 @@ deps =
usedevelop = True
deps =
{[base]deps}
django16: Django>=1.6,<1.7
django17: Django>=1.7,<1.8
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10a
commands =
......
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