From: Radek Czajka Date: Mon, 30 Mar 2020 12:55:08 +0000 (+0200) Subject: Updates. X-Git-Url: https://git.mdrn.pl/audio.git/commitdiff_plain/c84a8c9ad465608d565821914169f19f30b3b2c3?ds=sidebyside Updates. --- diff --git a/requirements.txt b/requirements.txt index 76f851d..d374c51 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -i https://py.mdrn.pl:8443/simple -django>=1.11,<2.0 -django-cas-ng==3.6.0 -django-bootstrap4==0.0.8 +Django==3.0.4 +django-cas-ng==4.1.1 +django-bootstrap4==1.1.1 django-pglocks==1.0.4 celery[redis]==4.4.0 diff --git a/src/apiclient/migrations/0001_initial.py b/src/apiclient/migrations/0001_initial.py index ee0c56c..dccd933 100644 --- a/src/apiclient/migrations/0001_initial.py +++ b/src/apiclient/migrations/0001_initial.py @@ -16,7 +16,7 @@ class Migration(migrations.Migration): ('access', models.BooleanField(default=False)), ('token', models.CharField(max_length=64, null=True, blank=True)), ('token_secret', models.CharField(max_length=64, null=True, blank=True)), - ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], options={ }, diff --git a/src/apiclient/models.py b/src/apiclient/models.py index 6c9542d..83979e8 100644 --- a/src/apiclient/models.py +++ b/src/apiclient/models.py @@ -3,7 +3,7 @@ from django.contrib.auth.models import User class OAuthConnection(models.Model): - user = models.ForeignKey(User) + user = models.ForeignKey(User, models.CASCADE) access = models.BooleanField(default=False) token = models.CharField(max_length=64, null=True, blank=True) token_secret = models.CharField(max_length=64, null=True, blank=True) diff --git a/src/apiclient/views.py b/src/apiclient/views.py index 351dd2e..f41f8f3 100644 --- a/src/apiclient/views.py +++ b/src/apiclient/views.py @@ -1,7 +1,5 @@ -import cgi - from django.contrib.auth.decorators import login_required -from django.core.urlresolvers import reverse +from django.urls import reverse from django.http import HttpResponseRedirect, HttpResponse import requests from requests_oauthlib import OAuth1Session diff --git a/src/archive/constants.py b/src/archive/constants.py index 17f4e78..6cb92a7 100644 --- a/src/archive/constants.py +++ b/src/archive/constants.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class status: WAITING = 1 diff --git a/src/archive/forms.py b/src/archive/forms.py index ad03308..22c426e 100644 --- a/src/archive/forms.py +++ b/src/archive/forms.py @@ -3,7 +3,7 @@ import os import os.path from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import mutagen from django.utils.encoding import force_bytes diff --git a/src/archive/migrations/0001_initial.py b/src/archive/migrations/0001_initial.py index 75c8b92..64d0c1d 100644 --- a/src/archive/migrations/0001_initial.py +++ b/src/archive/migrations/0001_initial.py @@ -63,7 +63,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='audiobook', name='project', - field=models.ForeignKey(verbose_name='project', to='archive.Project'), + field=models.ForeignKey(verbose_name='project', to='archive.Project', on_delete=models.CASCADE), preserve_default=True, ), ] diff --git a/src/archive/migrations/0002_auto_20200330_1446.py b/src/archive/migrations/0002_auto_20200330_1446.py new file mode 100644 index 0000000..37a0244 --- /dev/null +++ b/src/archive/migrations/0002_auto_20200330_1446.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.29 on 2020-03-30 14:46 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('archive', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='audiobook', + name='project', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='archive.Project', verbose_name='project'), + ), + ] diff --git a/src/archive/models.py b/src/archive/models.py index 9e92fb8..f0b751c 100644 --- a/src/archive/models.py +++ b/src/archive/models.py @@ -3,7 +3,7 @@ import os.path from django.db import models from time import sleep -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django_pglocks import advisory_lock from archive.constants import status from archive.settings import FILES_SAVE_PATH, ADVERT, LICENSE, ORGANIZATION, PROJECT @@ -43,7 +43,7 @@ class Audiobook(models.Model): conductor = models.CharField(max_length=255, verbose_name=_('conductor')) encoded_by = models.CharField(max_length=255, verbose_name=_('encoded by')) date = models.CharField(max_length=255, verbose_name=_('date')) - project = models.ForeignKey(Project, verbose_name=_('project')) + project = models.ForeignKey(Project, models.PROTECT, verbose_name=_('project')) url = models.URLField(max_length=255, verbose_name=_('book url')) translator = models.CharField(max_length=255, null=True, blank=True, verbose_name=_('translator')) modified = models.DateTimeField(null=True, editable=False) diff --git a/src/archive/views.py b/src/archive/views.py index 8621f64..8fbcd7e 100644 --- a/src/archive/views.py +++ b/src/archive/views.py @@ -1,5 +1,3 @@ -# Create your views here. - from datetime import datetime import os import os.path @@ -8,7 +6,7 @@ from urllib.parse import quote from archive import settings from django.contrib.auth import logout from django.contrib.auth.decorators import permission_required -from django.core.urlresolvers import reverse +from django.urls import reverse from django.db.models import Q, Max from django.http import Http404, HttpResponse from django.shortcuts import render, redirect, get_object_or_404 diff --git a/src/audiobooks/settings.py b/src/audiobooks/settings.py index 7b6250d..cfb9114 100644 --- a/src/audiobooks/settings.py +++ b/src/audiobooks/settings.py @@ -100,7 +100,7 @@ TEMPLATES = [ }, ] -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', diff --git a/src/audiobooks/urls.py b/src/audiobooks/urls.py index b80ad2c..5bde7e4 100644 --- a/src/audiobooks/urls.py +++ b/src/audiobooks/urls.py @@ -12,7 +12,7 @@ urlpatterns = [ url(r'^archive/', include('archive.urls')), url(r'^publish/', include('apiclient.urls')), - url(r'^admin/', include(admin.site.urls)), + url(r'^admin/', admin.site.urls), url(r'^accounts/login/$', django_cas_ng.views.LoginView.as_view(), name='login'), url(r'^accounts/logout/$', django_cas_ng.views.LogoutView.as_view(), name='logout'), ]