Add Django 3.0, DRF 3.11, drop Python 3.5, Django 2.1

This commit is contained in:
Cristi Vîjdea
2020-02-17 02:28:03 +02:00
parent 6a1166deb5
commit a872eb66d6
10 changed files with 41 additions and 43 deletions
-10
View File
@@ -193,16 +193,6 @@ LOGGING = {
'propagate': False,
},
'django': {
'handlers': ['console_log'],
'level': 'DEBUG',
'propagate': False,
},
'django.db.backends': {
'handlers': ['console_log'],
'level': 'INFO',
'propagate': False,
},
'django.template': {
'handlers': ['console_log'],
'level': 'INFO',
'propagate': False,
@@ -3,7 +3,7 @@ import sys
from django.conf import settings
from django.contrib.auth.hashers import make_password
from django.db import migrations, IntegrityError
from django.db import migrations, IntegrityError, transaction
def add_default_user(apps, schema_editor):
@@ -13,14 +13,15 @@ def add_default_user(apps, schema_editor):
User = apps.get_model(settings.AUTH_USER_MODEL)
try:
admin = User(
username=username,
email=email,
password=make_password(password),
is_superuser=True,
is_staff=True
)
admin.save()
with transaction.atomic():
admin = User(
username=username,
email=email,
password=make_password(password),
is_superuser=True,
is_staff=True
)
admin.save()
except IntegrityError:
sys.stdout.write(" User '%s <%s>' already exists..." % (username, email))
else: