Updates.
authorRadek Czajka <rczajka@rczajka.pl>
Mon, 30 Mar 2020 12:55:08 +0000 (14:55 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Mon, 30 Mar 2020 12:55:08 +0000 (14:55 +0200)
12 files changed:
requirements.txt
src/apiclient/migrations/0001_initial.py
src/apiclient/models.py
src/apiclient/views.py
src/archive/constants.py
src/archive/forms.py
src/archive/migrations/0001_initial.py
src/archive/migrations/0002_auto_20200330_1446.py [new file with mode: 0644]
src/archive/models.py
src/archive/views.py
src/audiobooks/settings.py
src/audiobooks/urls.py

index 76f851d..d374c51 100644 (file)
@@ -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
index ee0c56c..dccd933 100644 (file)
@@ -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={
             },
index 6c9542d..83979e8 100644 (file)
@@ -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)
index 351dd2e..f41f8f3 100644 (file)
@@ -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
index 17f4e78..6cb92a7 100644 (file)
@@ -1,4 +1,4 @@
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
 
 class status:
     WAITING = 1
index ad03308..22c426e 100644 (file)
@@ -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
 
index 75c8b92..64d0c1d 100644 (file)
@@ -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 (file)
index 0000000..37a0244
--- /dev/null
@@ -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'),
+        ),
+    ]
index 9e92fb8..f0b751c 100644 (file)
@@ -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)
index 8621f64..8fbcd7e 100644 (file)
@@ -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
index 7b6250d..cfb9114 100644 (file)
@@ -100,7 +100,7 @@ TEMPLATES = [
     },
 ]
 
-MIDDLEWARE_CLASSES = (
+MIDDLEWARE = (
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
index b80ad2c..5bde7e4 100644 (file)
@@ -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'),
 ]