浏览代码

Remove Django 1.7 support

We only support two versions of Django. That policy might change given
that Django has started doing LTS releases. But for now, it only makes
sense to remove Django 1.7 support.
master
Maik Hoepfel 10 年前
父节点
当前提交
afe08db409

+ 2
- 6
.travis.yml 查看文件

@@ -32,19 +32,15 @@ env:
32 32
         - PIP_WHEEL_DIR=$HOME/.cache/pip/wheels
33 33
         - PIP_FIND_LINKS=file://$HOME/.cache/pip/wheels
34 34
     matrix:
35
-        - DJANGO=Django==1.7.11
36
-        - DJANGO=Django==1.8.10
35
+        - DJANGO=Django==1.8.11
37 36
         - DJANGO=Django==1.9.3
38 37
 
39 38
 
40 39
 matrix:
41 40
     exclude:
42
-        - python: 3.2
43
-          env: "DJANGO=Django==1.9.3"
41
+        # Python 3.3 is not supported by Django 1.9
44 42
         - python: 3.3
45 43
           env: "DJANGO=Django==1.9.3"
46
-        - python: 3.5
47
-          env: "DJANGO=Django==1.7.11"
48 44
 
49 45
 before_install:
50 46
     - pip install codecov

+ 1
- 2
setup.py 查看文件

@@ -30,7 +30,7 @@ setup(name='django-oscar',
30 30
       packages=find_packages('src'),
31 31
       include_package_data=True,
32 32
       install_requires=[
33
-          'django>=1.7.8,<1.10',
33
+          'django>=1.8.8,<1.10',
34 34
           # PIL is required for image fields, Pillow is the "friendly" PIL fork
35 35
           'pillow>=1.7.8',
36 36
           # We use the ModelFormSetView from django-extra-views for the basket
@@ -67,7 +67,6 @@ setup(name='django-oscar',
67 67
           'Development Status :: 5 - Production/Stable',
68 68
           'Environment :: Web Environment',
69 69
           'Framework :: Django',
70
-          'Framework :: Django :: 1.7',
71 70
           'Framework :: Django :: 1.8',
72 71
           'Framework :: Django :: 1.9',
73 72
           'Intended Audience :: Developers',

+ 31
- 35
sites/sandbox/apps/user/models.py 查看文件

@@ -3,6 +3,8 @@ Sample user/profile models for testing.  These aren't enabled by default in the
3 3
 sandbox
4 4
 """
5 5
 
6
+from django.contrib.auth.models import (
7
+    AbstractUser, BaseUserManager, AbstractBaseUser)
6 8
 from django.db import models
7 9
 from django.utils import timezone
8 10
 from django.utils.encoding import python_2_unicode_compatible
@@ -25,49 +27,43 @@ class Profile(models.Model):
25 27
     age = models.PositiveIntegerField(verbose_name='Age')
26 28
 
27 29
 
28
-# A simple extension of the core User model for Django 1.5
29
-try:
30
-    from django.contrib.auth.models import (
31
-        AbstractUser, BaseUserManager, AbstractBaseUser)
32
-except ImportError:
33
-    pass
34
-else:
30
+# A simple extension of the core User model for Django 1.5+
31
+class ExtendedUserModel(AbstractUser):
32
+    twitter_username = models.CharField(max_length=255, unique=True)
35 33
 
36
-    class ExtendedUserModel(AbstractUser):
37
-        twitter_username = models.CharField(max_length=255, unique=True)
38 34
 
39
-    class CustomUserManager(BaseUserManager):
35
+class CustomUserManager(BaseUserManager):
40 36
 
41
-        def create_user(self, email, password=None):
42
-            now = timezone.now()
43
-            email = BaseUserManager.normalize_email(email)
44
-            user = self.model(email=email, last_login=now)
45
-            user.set_password(password)
46
-            user.save(using=self._db)
47
-            return user
37
+    def create_user(self, email, password=None):
38
+        now = timezone.now()
39
+        email = BaseUserManager.normalize_email(email)
40
+        user = self.model(email=email, last_login=now)
41
+        user.set_password(password)
42
+        user.save(using=self._db)
43
+        return user
48 44
 
49
-        def create_superuser(self, email, password):
50
-            return self.create_user(email, password)
45
+    def create_superuser(self, email, password):
46
+        return self.create_user(email, password)
51 47
 
52
-    # A user model which doesn't extend AbstractUser
53
-    @python_2_unicode_compatible
54
-    class CustomUserModel(AbstractBaseUser):
55
-        name = models.CharField(max_length=255, blank=True)
56
-        email = models.EmailField(unique=True)
57
-        twitter_username = models.CharField(max_length=255, unique=True)
48
+# A user model which doesn't extend AbstractUser
49
+@python_2_unicode_compatible
50
+class CustomUserModel(AbstractBaseUser):
51
+    name = models.CharField(max_length=255, blank=True)
52
+    email = models.EmailField(unique=True)
53
+    twitter_username = models.CharField(max_length=255, unique=True)
58 54
 
59
-        USERNAME_FIELD = 'email'
55
+    USERNAME_FIELD = 'email'
60 56
 
61
-        objects = CustomUserManager()
57
+    objects = CustomUserManager()
62 58
 
63
-        def __str__(self):
64
-            return self.email
59
+    def __str__(self):
60
+        return self.email
65 61
 
66
-        def get_full_name(self):
67
-            return self.name
62
+    def get_full_name(self):
63
+        return self.name
68 64
 
69
-        get_short_name = get_full_name
65
+    get_short_name = get_full_name
70 66
 
71
-    # A simple extension of the core Oscar User model
72
-    class ExtendedOscarUserModel(abstract_models.AbstractUser):
73
-        twitter_username = models.CharField(max_length=255, unique=True)
67
+# A simple extension of the core Oscar User model
68
+class ExtendedOscarUserModel(abstract_models.AbstractUser):
69
+    twitter_username = models.CharField(max_length=255, unique=True)

+ 1
- 2
src/oscar/apps/catalogue/reviews/abstract_models.py 查看文件

@@ -43,8 +43,7 @@ class AbstractProductReview(models.Model):
43 43
     name = models.CharField(
44 44
         pgettext_lazy(u"Anonymous reviewer name", u"Name"),
45 45
         max_length=255, blank=True)
46
-    # TODO Remove the max_length kwarg when support for Django 1.7 is dropped
47
-    email = models.EmailField(_("Email"), max_length=75, blank=True)
46
+    email = models.EmailField(_("Email"), blank=True)
48 47
     homepage = models.URLField(_("URL"), blank=True)
49 48
 
50 49
     FOR_MODERATION, APPROVED, REJECTED = 0, 1, 2

+ 1
- 3
src/oscar/apps/customer/abstract_models.py 查看文件

@@ -312,9 +312,7 @@ class AbstractProductAlert(models.Model):
312 312
     user = models.ForeignKey(AUTH_USER_MODEL, db_index=True, blank=True,
313 313
                              null=True, related_name="alerts",
314 314
                              verbose_name=_('User'))
315
-    # TODO Remove the max_length kwarg when support for Django 1.7 is dropped
316
-    email = models.EmailField(_("Email"), db_index=True, blank=True,
317
-                              max_length=75)
315
+    email = models.EmailField(_("Email"), db_index=True, blank=True)
318 316
 
319 317
     # This key are used to confirm and cancel alerts for anon users
320 318
     key = models.CharField(_("Key"), max_length=128, blank=True, db_index=True)

+ 1
- 3
src/oscar/apps/order/abstract_models.py 查看文件

@@ -80,9 +80,7 @@ class AbstractOrder(models.Model):
80 80
 
81 81
     # Use this field to indicate that an order is on hold / awaiting payment
82 82
     status = models.CharField(_("Status"), max_length=100, blank=True)
83
-    # TODO Remove the max_length kwarg when support for Django 1.7 is dropped
84
-    guest_email = models.EmailField(_("Guest email address"), max_length=75,
85
-                                    blank=True)
83
+    guest_email = models.EmailField(_("Guest email address"), blank=True)
86 84
 
87 85
     # Index added to this field for reporting
88 86
     date_placed = models.DateTimeField(db_index=True)

+ 3
- 3
tox.ini 查看文件

@@ -4,11 +4,11 @@ max-complexity = 10
4 4
 ignore = W503
5 5
 
6 6
 [tox]
7
-envlist = {py27,py33,py34}-{1.7,1.8}
7
+envlist = {py27,py33,py34,py35}-{1.8,1.9}
8 8
 
9 9
 [testenv]
10 10
 commands = python runtests.py
11 11
 deps = 
12 12
     -r{toxinidir}/requirements.txt
13
-    1.7: django==1.7.8
14
-    1.8: django==1.8.1
13
+    1.8: django==1.8.8
14
+    1.9: django==1.9.1

正在加载...
取消
保存