Skip to content

Commit 6febe5b

Browse files
committed
resolve django warnings for AutoField and default_app_config
1 parent cd47d87 commit 6febe5b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

dbcleanup/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
__version__ = '0.1.1'
22

3-
default_app_config = 'dbcleanup.apps.DBCleanupConfig'
3+
# set default_app_config when using django earlier than 3.2
4+
try:
5+
import django
6+
7+
if django.VERSION < (3, 2):
8+
default_app_config = 'dbcleanup.apps.DBCleanupConfig'
9+
except ImportError:
10+
pass

dbcleanup/apps.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
class DBCleanupConfig(AppConfig):
1313
name = 'dbcleanup'
14+
default_auto_field = 'django.db.models.AutoField'
1415

1516
def ready(self):
1617
super().ready()

0 commit comments

Comments
 (0)