Skip to content

Commit 0a5f4e5

Browse files
author
Ryan P Kilby
committed
Merge pull request #51 from rpkilby/django-update
Update Django version support
2 parents 3730f5c + 610a72e commit 0a5f4e5

File tree

4 files changed

+16
-53
lines changed

4 files changed

+16
-53
lines changed

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
language: python
2+
3+
sudo: false
4+
25
python:
36
- "2.7"
47
- "3.2"
58
- "3.3"
69
- "3.4"
710
- "3.5"
811
env:
9-
- DJANGO="Django>=1.7,<1.8"
1012
- DJANGO="Django>=1.8,<1.9"
13+
- DJANGO="Django>=1.9,<1.10"
1114
install:
1215
- travis_retry pip install -q $DJANGO
1316
- python setup.py install
1417
script: python manage.py test rest_framework_filters
1518

1619
matrix:
1720
exclude:
18-
- python: "3.5"
19-
env: DJANGO="Django>=1.7,<1.8"
21+
- python: "3.2"
22+
env: DJANGO="Django>=1.9,<1.10"
23+
- python: "3.3"
24+
env: DJANGO="Django>=1.9,<1.10"
2025
fast_finish: true

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Requirements
2121
------------
2222

2323
* Python 2.7+
24-
* Django 1.7.10+
24+
* Django 1.8+
2525
* Django REST framework 3.0+
2626

2727
Usage

rest_framework_filters/filterset.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@
44
from collections import OrderedDict
55
import copy
66

7-
from django.db.models.constants import LOOKUP_SEP
87
from django.db import models
9-
try:
10-
from django.db.models.related import RelatedObject as ForeignObjectRel
11-
except ImportError: # pragma: nocover
12-
# Django >= 1.8 replaces RelatedObject with ForeignObjectRel
13-
from django.db.models.fields.related import ForeignObjectRel
8+
from django.db.models.constants import LOOKUP_SEP
9+
from django.db.models.fields.related import ForeignObjectRel
1410
from django.utils import six
1511

1612
import django_filters

tests/test_filterset.py

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44

55
import datetime
66

7-
from django.utils.dateparse import parse_time, parse_datetime
8-
9-
import django
107
from django.test import TestCase, override_settings
118
from django.contrib.auth.models import User
9+
from django.utils.dateparse import parse_time, parse_datetime
1210

1311
from .models import (
1412
Note, Post, Cover, Page, A, B, C, Person, Tag, BlogPost,
@@ -49,17 +47,8 @@ def add_timedelta(time, timedelta):
4947

5048
class TestFilterSets(TestCase):
5149

52-
if django.VERSION >= (1, 8):
53-
@classmethod
54-
def setUpTestData(cls):
55-
cls.generateTestData()
56-
57-
else:
58-
def setUp(self):
59-
self.generateTestData()
60-
6150
@classmethod
62-
def generateTestData(cls):
51+
def setUpTestData(cls):
6352
#######################
6453
# Create users
6554
#######################
@@ -326,17 +315,8 @@ def test_get_filterset_subset(self):
326315

327316
class DatetimeTests(TestCase):
328317

329-
if django.VERSION >= (1, 8):
330-
@classmethod
331-
def setUpTestData(cls):
332-
cls.generateTestData()
333-
334-
else:
335-
def setUp(self):
336-
self.generateTestData()
337-
338318
@classmethod
339-
def generateTestData(cls):
319+
def setUpTestData(cls):
340320
john = Person.objects.create(name="John")
341321

342322
# Created at least one second apart
@@ -428,17 +408,8 @@ class Meta:
428408

429409
class FilterOverrideTests(TestCase):
430410

431-
if django.VERSION >= (1, 8):
432-
@classmethod
433-
def setUpTestData(cls):
434-
cls.generateTestData()
435-
436-
else:
437-
def setUp(self):
438-
self.generateTestData()
439-
440411
@classmethod
441-
def generateTestData(cls):
412+
def setUpTestData(cls):
442413
john = Person.objects.create(name="John")
443414
Person.objects.create(name="Mark", best_friend=john)
444415

@@ -519,17 +490,8 @@ def test_inset_char_filter(self):
519490

520491
class FilterExclusionTests(TestCase):
521492

522-
if django.VERSION >= (1, 8):
523-
@classmethod
524-
def setUpTestData(cls):
525-
cls.generateTestData()
526-
527-
else:
528-
def setUp(self):
529-
self.generateTestData()
530-
531493
@classmethod
532-
def generateTestData(cls):
494+
def setUpTestData(cls):
533495
t1 = Tag.objects.create(name='Tag 1')
534496
t2 = Tag.objects.create(name='Tag 2')
535497
t3 = Tag.objects.create(name='Something else entirely')

0 commit comments

Comments
 (0)