Skip to content

Commit bef2e45

Browse files
committed
Remove Django 3.2 code
1 parent 1161828 commit bef2e45

File tree

6 files changed

+10
-31
lines changed

6 files changed

+10
-31
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Silk is a live profiling and inspection tool for the Django framework. Silk inte
3030

3131
Silk has been tested with:
3232

33-
* Django: 3.2, 4.2, 5.0, 5.1
33+
* Django: 4.2, 5.0, 5.1
3434
* Python: 3.8, 3.9, 3.10, 3.11, 3.12
3535

3636
## Installation

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ Features
5757
Requirements
5858
------------
5959

60-
* Django: 3.2, 4.2, 5.0, 5.1
60+
* Django: 4.2, 5.0, 5.1
6161
* Python: 3.8, 3.9, 3.10

project/project/settings.py

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
ROOT_URLCONF = 'project.urls'
2424

25-
# Django 3.2+
2625
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
2726

2827
MIDDLEWARE = [

project/tests/test_view_requests.py

-13
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,6 @@ def test_order_by(self):
2626

2727

2828
class TestContext(TestCase):
29-
def assertQuerySetEqual(self, *args, **kwargs):
30-
"""
31-
A shim for QuerySetEqual to enable support for multiple versions of Django
32-
TODO: delete this after support for Django 3.2 is dropped
33-
Reference: https://docs.djangoproject.com/en/5.0/topics/testing/tools/#django.test.TransactionTestCase.assertQuerySetEqual
34-
"""
35-
if hasattr(super(), 'assertQuerySetEqual'):
36-
# Django > 3.2
37-
super().assertQuerySetEqual(*args, **kwargs)
38-
else:
39-
# Django < 5.1
40-
super().assertQuerysetEqual(*args, **kwargs)
41-
4229
def test_default(self):
4330
request = Mock(spec_set=['GET', 'session'])
4431
request.session = {}

setup.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
'Development Status :: 5 - Production/Stable',
2222
'Environment :: Web Environment',
2323
'Framework :: Django',
24-
'Framework :: Django :: 3.2',
2524
'Framework :: Django :: 4.2',
2625
'Framework :: Django :: 5.0',
2726
'Framework :: Django :: 5.1',
@@ -37,7 +36,7 @@
3736
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
3837
],
3938
install_requires=[
40-
'Django>=3.2',
39+
'Django>=4.2',
4140
'sqlparse',
4241
'autopep8',
4342
'gprof2dot>=2017.09.19',

silk/models.py

+7-13
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,14 @@
2626
from silk.config import SilkyConfig
2727
from silk.utils.profile_parser import parse_profile
2828

29+
from django.core.files.storage import storages
30+
from django.core.files.storage.handler import InvalidStorageError
2931
try:
30-
# New in Django 4.2
31-
from django.core.files.storage import storages
32-
from django.core.files.storage.handler import InvalidStorageError
33-
try:
34-
silk_storage = storages['SILKY_STORAGE']
35-
except InvalidStorageError:
36-
from django.utils.module_loading import import_string
37-
storage_class = SilkyConfig().SILKY_STORAGE_CLASS or settings.DEFAULT_FILE_STORAGE
38-
silk_storage = import_string(storage_class)()
39-
except ImportError:
40-
# Deprecated since Django 4.2, Removed in Django 5.1
41-
from django.core.files.storage import get_storage_class
42-
silk_storage = get_storage_class(SilkyConfig().SILKY_STORAGE_CLASS)()
32+
silk_storage = storages['SILKY_STORAGE']
33+
except InvalidStorageError:
34+
from django.utils.module_loading import import_string
35+
storage_class = SilkyConfig().SILKY_STORAGE_CLASS or settings.DEFAULT_FILE_STORAGE
36+
silk_storage = import_string(storage_class)()
4337

4438

4539
# Seperated out so can use in tests w/o models

0 commit comments

Comments
 (0)