From b6a870c0e5136ff95399ea5d0f4e2652d4d94010 Mon Sep 17 00:00:00 2001 From: dadosch Date: Fri, 24 Aug 2018 21:31:43 +0200 Subject: [PATCH 1/9] django v2 compatible: tests needed --- requirements.txt | 106 ++++++++++++++++++++-------------------- src/documents/admin.py | 5 +- src/documents/models.py | 5 +- src/paperless/urls.py | 4 +- src/reminders/models.py | 2 +- 5 files changed, 64 insertions(+), 58 deletions(-) diff --git a/requirements.txt b/requirements.txt index 125a89ac7..69c1afd48 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,53 +1,53 @@ -apipkg==1.4 -attrs==18.1.0 -certifi==2018.4.16 -chardet==3.0.4 -coverage==4.5.1 -coveralls==1.3.0 -dateparser==0.7.0 -django-cors-headers==2.4.0 -django-crispy-forms==1.7.2 -django-extensions==2.0.7 -django-filter==1.1.0 -django-flat-responsive==2.0 -django==1.11.13 -djangorestframework==3.8.2 -docopt==0.6.2 -execnet==1.5.0 -factory-boy==2.11.1 -faker==0.8.15 -filemagic==1.6 -flake8==3.5.0 -fuzzywuzzy==0.15.0 -gunicorn==19.8.1 -idna==2.6 -inotify_simple==1.1.7; sys_platform == 'linux' -langdetect==1.0.7 -mccabe==0.6.1 -more-itertools==4.1.0 -pdftotext==2.0.2 -pillow==5.1.0 -pluggy==0.6.0 -py==1.5.3 -pycodestyle==2.3.1 -pyflakes==1.6.0 -pyocr==0.5.1 -pytest-cov==2.5.1 -pytest-django==3.2.1 -pytest-env==0.6.2 -pytest-forked==0.2 -pytest-sugar==0.9.1 -pytest-xdist==1.22.2 -pytest==3.5.1 -python-dateutil==2.7.3 -python-dotenv==0.8.2 -python-gnupg==0.4.2 -python-levenshtein==0.12.0 -pytz==2018.4 -regex==2018.2.21 -requests==2.18.4 -six==1.11.0 -termcolor==1.1.0 -text-unidecode==1.2 -tzlocal==1.5.1 -urllib3==1.22 +apipkg>=1.4 +attrs>=18.1.0 +certifi>=2018.4.16 +chardet>=3.0.4 +coverage>=4.5.1 +coveralls>=1.3.0 +dateparser>=0.7.0 +django-cors-headers>=2.4.0 +django-crispy-forms>=1.7.2 +django-extensions>=2.0.7 +django-filter>=2.0.0 +django-flat-responsive>=2.0 +django>=2.1 +djangorestframework>=3.8.2 +docopt>=0.6.2 +execnet>=1.5.0 +factory-boy>=2.11.1 +faker>=0.8.15 +filemagic>=1.6 +flake8>=3.5.0 +fuzzywuzzy>=0.15.0 +gunicorn>=19.8.1 +idna>=2.6 +inotify_simple>=1.1.7; sys_platform == 'linux' +langdetect>=1.0.7 +mccabe>=0.6.1 +more-itertools>=4.1.0 +pdftotext>=2.0.2 +pillow>=5.1.0 +pluggy>=0.6.0 +py>=1.5.3 +pycodestyle>=2.3.1 +pyflakes>=1.6.0 +pyocr>=0.5.1 +pytest-cov>=2.5.1 +pytest-django>=3.2.1 +pytest-env>=0.6.2 +pytest-forked>=0.2 +pytest-sugar>=0.9.1 +pytest-xdist>=1.22.2 +pytest>=3.5.1 +python-dateutil>=2.7.3 +python-dotenv>=0.8.2 +python-gnupg>=0.4.2 +python-levenshtein>=0.12.0 +pytz>=2018.4 +regex>=2018.2.21 +requests>=2.18.4 +six>=1.11.0 +termcolor>=1.1.0 +text-unidecode>=1.2 +tzlocal>=1.5.1 +urllib3>=1.22 diff --git a/src/documents/admin.py b/src/documents/admin.py index 659ad8581..327aaab22 100644 --- a/src/documents/admin.py +++ b/src/documents/admin.py @@ -3,7 +3,10 @@ from datetime import datetime from django.conf import settings from django.contrib import admin from django.contrib.auth.models import User, Group -from django.core.urlresolvers import reverse +try: + from django.core.urlresolvers import reverse +except: + from django.urls import reverse from django.templatetags.static import static from .models import Correspondent, Tag, Document, Log diff --git a/src/documents/models.py b/src/documents/models.py index 7390c1d3c..ad7521abc 100644 --- a/src/documents/models.py +++ b/src/documents/models.py @@ -10,7 +10,10 @@ from collections import OrderedDict from fuzzywuzzy import fuzz from django.conf import settings -from django.core.urlresolvers import reverse +try: + from django.core.urlresolvers import reverse +except: + from django.urls import reverse from django.db import models from django.template.defaultfilters import slugify from django.utils import timezone diff --git a/src/paperless/urls.py b/src/paperless/urls.py index e5e559f12..468bb768c 100644 --- a/src/paperless/urls.py +++ b/src/paperless/urls.py @@ -28,9 +28,9 @@ urlpatterns = [ # API url( r"^api/auth/", - include('rest_framework.urls', namespace="rest_framework") + include(('rest_framework.urls','rest_framework'), namespace="rest_framework") ), - url(r"^api/", include(router.urls, namespace="drf")), + url(r"^api/", include((router.urls, 'drf'), namespace="drf")), # File downloads url( diff --git a/src/reminders/models.py b/src/reminders/models.py index d6fb744f7..c01b5193e 100644 --- a/src/reminders/models.py +++ b/src/reminders/models.py @@ -3,6 +3,6 @@ from django.db import models class Reminder(models.Model): - document = models.ForeignKey("documents.Document") + document = models.ForeignKey("documents.Document",on_delete=models.DO_NOTHING) date = models.DateTimeField() note = models.TextField(blank=True) From 6cd06f6c8a68f039f88ef82e09d8cf9faa8ef51c Mon Sep 17 00:00:00 2001 From: dadosch Date: Fri, 24 Aug 2018 21:52:27 +0200 Subject: [PATCH 2/9] improved codestyle, go back to == in requirements --- requirements.txt | 106 ++++++++++++++++++++-------------------- src/documents/admin.py | 2 +- src/documents/models.py | 2 +- src/paperless/urls.py | 4 +- src/reminders/models.py | 4 +- 5 files changed, 61 insertions(+), 57 deletions(-) diff --git a/requirements.txt b/requirements.txt index 69c1afd48..23fab569f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,53 +1,53 @@ -apipkg>=1.4 -attrs>=18.1.0 -certifi>=2018.4.16 -chardet>=3.0.4 -coverage>=4.5.1 -coveralls>=1.3.0 -dateparser>=0.7.0 -django-cors-headers>=2.4.0 -django-crispy-forms>=1.7.2 -django-extensions>=2.0.7 -django-filter>=2.0.0 -django-flat-responsive>=2.0 -django>=2.1 -djangorestframework>=3.8.2 -docopt>=0.6.2 -execnet>=1.5.0 -factory-boy>=2.11.1 -faker>=0.8.15 -filemagic>=1.6 -flake8>=3.5.0 -fuzzywuzzy>=0.15.0 -gunicorn>=19.8.1 -idna>=2.6 -inotify_simple>=1.1.7; sys_platform == 'linux' -langdetect>=1.0.7 -mccabe>=0.6.1 -more-itertools>=4.1.0 -pdftotext>=2.0.2 -pillow>=5.1.0 -pluggy>=0.6.0 -py>=1.5.3 -pycodestyle>=2.3.1 -pyflakes>=1.6.0 -pyocr>=0.5.1 -pytest-cov>=2.5.1 -pytest-django>=3.2.1 -pytest-env>=0.6.2 -pytest-forked>=0.2 -pytest-sugar>=0.9.1 -pytest-xdist>=1.22.2 -pytest>=3.5.1 -python-dateutil>=2.7.3 -python-dotenv>=0.8.2 -python-gnupg>=0.4.2 -python-levenshtein>=0.12.0 -pytz>=2018.4 -regex>=2018.2.21 -requests>=2.18.4 -six>=1.11.0 -termcolor>=1.1.0 -text-unidecode>=1.2 -tzlocal>=1.5.1 -urllib3>=1.22 +apipkg==1.4 +attrs==18.1.0 +certifi==2018.4.16 +chardet==3.0.4 +coverage==4.5.1 +coveralls==1.3.0 +dateparser==0.7.0 +django-cors-headers==2.4.0 +django-crispy-forms==1.7.2 +django-extensions==2.0.7 +django-filter==2.0.0 +django-flat-responsive==2.0 +django>=2.0 +djangorestframework==3.8.2 +docopt==0.6.2 +execnet==1.5.0 +factory-boy==2.11.1 +faker==0.8.15 +filemagic==1.6 +flake8==3.5.0 +fuzzywuzzy==0.15.0 +gunicorn==19.8.1 +idna==2.6 +inotify_simple==1.1.7; sys_platform == 'linux' +langdetect==1.0.7 +mccabe==0.6.1 +more-itertools==4.1.0 +pdftotext==2.0.2 +pillow==5.1.0 +pluggy==0.6.0 +py==1.5.3 +pycodestyle==2.3.1 +pyflakes==1.6.0 +pyocr==0.5.1 +pytest-cov==2.5.1 +pytest-django==3.2.1 +pytest-env==0.6.2 +pytest-forked==0.2 +pytest-sugar==0.9.1 +pytest-xdist==1.22.2 +pytest==3.5.1 +python-dateutil==2.7.3 +python-dotenv==0.8.2 +python-gnupg==0.4.2 +python-levenshtein==0.12.0 +pytz==2018.4 +regex==2018.2.21 +requests==2.18.4 +six==1.11.0 +termcolor==1.1.0 +text-unidecode==1.2 +tzlocal==1.5.1 +urllib3==1.22 diff --git a/src/documents/admin.py b/src/documents/admin.py index 327aaab22..534f9143b 100644 --- a/src/documents/admin.py +++ b/src/documents/admin.py @@ -5,7 +5,7 @@ from django.contrib import admin from django.contrib.auth.models import User, Group try: from django.core.urlresolvers import reverse -except: +except ImportError: from django.urls import reverse from django.templatetags.static import static diff --git a/src/documents/models.py b/src/documents/models.py index ad7521abc..971451268 100644 --- a/src/documents/models.py +++ b/src/documents/models.py @@ -12,7 +12,7 @@ from fuzzywuzzy import fuzz from django.conf import settings try: from django.core.urlresolvers import reverse -except: +except ImportError: from django.urls import reverse from django.db import models from django.template.defaultfilters import slugify diff --git a/src/paperless/urls.py b/src/paperless/urls.py index 468bb768c..f66ce6664 100644 --- a/src/paperless/urls.py +++ b/src/paperless/urls.py @@ -28,7 +28,9 @@ urlpatterns = [ # API url( r"^api/auth/", - include(('rest_framework.urls','rest_framework'), namespace="rest_framework") + include( + ('rest_framework.urls', 'rest_framework'), + namespace="rest_framework") ), url(r"^api/", include((router.urls, 'drf'), namespace="drf")), diff --git a/src/reminders/models.py b/src/reminders/models.py index c01b5193e..b34c455aa 100644 --- a/src/reminders/models.py +++ b/src/reminders/models.py @@ -3,6 +3,8 @@ from django.db import models class Reminder(models.Model): - document = models.ForeignKey("documents.Document",on_delete=models.DO_NOTHING) + document = models.ForeignKey( + "documents.Document", on_delete=models.DO_NOTHING + ) date = models.DateTimeField() note = models.TextField(blank=True) From 40e79a731fb186ddfbc3b15b03302a727fa5b215 Mon Sep 17 00:00:00 2001 From: dadosch Date: Fri, 24 Aug 2018 22:03:26 +0200 Subject: [PATCH 3/9] builds failing maybe because of old versions --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 23fab569f..5f7a0f081 100644 --- a/requirements.txt +++ b/requirements.txt @@ -33,12 +33,12 @@ pycodestyle==2.3.1 pyflakes==1.6.0 pyocr==0.5.1 pytest-cov==2.5.1 -pytest-django==3.2.1 +pytest-django==3.4.2 pytest-env==0.6.2 pytest-forked==0.2 pytest-sugar==0.9.1 -pytest-xdist==1.22.2 -pytest==3.5.1 +pytest-xdist==1.22.5 +pytest==3.7.2 python-dateutil==2.7.3 python-dotenv==0.8.2 python-gnupg==0.4.2 From 91cecd47af81015b519ca65f67088d050983ac3f Mon Sep 17 00:00:00 2001 From: dadosch Date: Wed, 29 Aug 2018 00:04:48 +0200 Subject: [PATCH 4/9] apply some patches from @brookst --- requirements.txt | 12 ++++++------ src/documents/migrations/0003_sender.py | 2 +- .../migrations/0011_auto_20160303_1929.py | 2 +- .../migrations/0012_auto_20160305_0040.py | 2 +- .../migrations/0014_document_checksum.py | 2 +- .../migrations/0019_add_consumer_user.py | 2 +- .../migrations/0020_document_added.py | 2 +- src/paperless/settings.py | 9 ++++----- .../migrations/0002_auto_20180824_2018.py | 19 +++++++++++++++++++ src/reminders/models.py | 2 +- 10 files changed, 36 insertions(+), 18 deletions(-) create mode 100644 src/reminders/migrations/0002_auto_20180824_2018.py diff --git a/requirements.txt b/requirements.txt index 5f7a0f081..1e1158b31 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,13 @@ -apipkg==1.4 +apipkg==1.5 attrs==18.1.0 -certifi==2018.4.16 +certifi>=2018.8.24 chardet==3.0.4 coverage==4.5.1 -coveralls==1.3.0 +coveralls==1.4.0 dateparser==0.7.0 django-cors-headers==2.4.0 django-crispy-forms==1.7.2 -django-extensions==2.0.7 +django-extensions==2.1.0 django-filter==2.0.0 django-flat-responsive==2.0 django>=2.0 @@ -15,7 +15,7 @@ djangorestframework==3.8.2 docopt==0.6.2 execnet==1.5.0 factory-boy==2.11.1 -faker==0.8.15 +faker==0.9.0 filemagic==1.6 flake8==3.5.0 fuzzywuzzy==0.15.0 @@ -27,7 +27,7 @@ mccabe==0.6.1 more-itertools==4.1.0 pdftotext==2.0.2 pillow==5.1.0 -pluggy==0.6.0 +pluggy==0.7.1 py==1.5.3 pycodestyle==2.3.1 pyflakes==1.6.0 diff --git a/src/documents/migrations/0003_sender.py b/src/documents/migrations/0003_sender.py index ce2508994..d3aad9903 100644 --- a/src/documents/migrations/0003_sender.py +++ b/src/documents/migrations/0003_sender.py @@ -32,7 +32,7 @@ def realign_senders(apps, schema_editor): class Migration(migrations.Migration): - + atomic = False dependencies = [ ('documents', '0002_auto_20151226_1316'), ] diff --git a/src/documents/migrations/0011_auto_20160303_1929.py b/src/documents/migrations/0011_auto_20160303_1929.py index af4ee4c66..7b77a8835 100644 --- a/src/documents/migrations/0011_auto_20160303_1929.py +++ b/src/documents/migrations/0011_auto_20160303_1929.py @@ -6,7 +6,7 @@ from django.db import migrations class Migration(migrations.Migration): - + atomic = False dependencies = [ ('documents', '0010_log'), ] diff --git a/src/documents/migrations/0012_auto_20160305_0040.py b/src/documents/migrations/0012_auto_20160305_0040.py index 5168c9206..f1659f4a1 100644 --- a/src/documents/migrations/0012_auto_20160305_0040.py +++ b/src/documents/migrations/0012_auto_20160305_0040.py @@ -112,7 +112,7 @@ def move_documents_and_create_thumbnails(apps, schema_editor): class Migration(migrations.Migration): - + atomic = False dependencies = [ ('documents', '0011_auto_20160303_1929'), ] diff --git a/src/documents/migrations/0014_document_checksum.py b/src/documents/migrations/0014_document_checksum.py index 167245dea..b58b9ebc1 100644 --- a/src/documents/migrations/0014_document_checksum.py +++ b/src/documents/migrations/0014_document_checksum.py @@ -128,7 +128,7 @@ def do_nothing(apps, schema_editor): class Migration(migrations.Migration): - + atomic = False dependencies = [ ('documents', '0013_auto_20160325_2111'), ] diff --git a/src/documents/migrations/0019_add_consumer_user.py b/src/documents/migrations/0019_add_consumer_user.py index a3d7d787e..82670e53f 100644 --- a/src/documents/migrations/0019_add_consumer_user.py +++ b/src/documents/migrations/0019_add_consumer_user.py @@ -15,7 +15,7 @@ def reverse_func(apps, schema_editor): class Migration(migrations.Migration): - + atomic = False dependencies = [ ('documents', '0018_auto_20170715_1712'), ] diff --git a/src/documents/migrations/0020_document_added.py b/src/documents/migrations/0020_document_added.py index dbddf80ae..485c04671 100644 --- a/src/documents/migrations/0020_document_added.py +++ b/src/documents/migrations/0020_document_added.py @@ -12,7 +12,7 @@ def set_added_time_to_created_time(apps, schema_editor): doc.save() class Migration(migrations.Migration): - + atomic = False dependencies = [ ('documents', '0019_add_consumer_user'), ] diff --git a/src/paperless/settings.py b/src/paperless/settings.py index e40af01d1..dec20ec3c 100644 --- a/src/paperless/settings.py +++ b/src/paperless/settings.py @@ -82,14 +82,13 @@ if os.getenv("PAPERLESS_INSTALLED_APPS"): -MIDDLEWARE_CLASSES = [ +MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] @@ -99,9 +98,9 @@ CORS_ORIGIN_WHITELIST = tuple(os.getenv("PAPERLESS_CORS_ALLOWED_HOSTS", "localho # If auth is disabled, we just use our "bypass" authentication middleware if bool(os.getenv("PAPERLESS_DISABLE_LOGIN", "false").lower() in ("yes", "y", "1", "t", "true")): - _index = MIDDLEWARE_CLASSES.index("django.contrib.auth.middleware.AuthenticationMiddleware") - MIDDLEWARE_CLASSES[_index] = "paperless.middleware.Middleware" - MIDDLEWARE_CLASSES.remove("django.contrib.auth.middleware.SessionAuthenticationMiddleware") + _index = MIDDLEWARE.index("django.contrib.auth.middleware.AuthenticationMiddleware") + MIDDLEWARE[_index] = "paperless.middleware.Middleware" + MIDDLEWARE.remove("django.contrib.auth.middleware.SessionAuthenticationMiddleware") ROOT_URLCONF = 'paperless.urls' diff --git a/src/reminders/migrations/0002_auto_20180824_2018.py b/src/reminders/migrations/0002_auto_20180824_2018.py new file mode 100644 index 000000000..4056767bf --- /dev/null +++ b/src/reminders/migrations/0002_auto_20180824_2018.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1 on 2018-08-24 20:18 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('reminders', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='reminder', + name='document', + field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='documents.Document'), + ), + ] diff --git a/src/reminders/models.py b/src/reminders/models.py index b34c455aa..64affaf77 100644 --- a/src/reminders/models.py +++ b/src/reminders/models.py @@ -4,7 +4,7 @@ from django.db import models class Reminder(models.Model): document = models.ForeignKey( - "documents.Document", on_delete=models.DO_NOTHING + "documents.Document", on_delete=models.PROTECTION ) date = models.DateTimeField() note = models.TextField(blank=True) From 633d2b376fedba1e0967fac291bc5ca6279c485a Mon Sep 17 00:00:00 2001 From: dadosch Date: Wed, 29 Aug 2018 00:08:01 +0200 Subject: [PATCH 5/9] PROTECT, not PROTECTION --- src/reminders/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reminders/models.py b/src/reminders/models.py index 64affaf77..77d872afb 100644 --- a/src/reminders/models.py +++ b/src/reminders/models.py @@ -4,7 +4,7 @@ from django.db import models class Reminder(models.Model): document = models.ForeignKey( - "documents.Document", on_delete=models.PROTECTION + "documents.Document", on_delete=models.PROTECT ) date = models.DateTimeField() note = models.TextField(blank=True) From 0b9c4f9963b289c16d107805f117519cbb8891b5 Mon Sep 17 00:00:00 2001 From: dadosch Date: Wed, 29 Aug 2018 00:19:08 +0200 Subject: [PATCH 6/9] remove my auto generated migration file --- .../migrations/0002_auto_20180824_2018.py | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 src/reminders/migrations/0002_auto_20180824_2018.py diff --git a/src/reminders/migrations/0002_auto_20180824_2018.py b/src/reminders/migrations/0002_auto_20180824_2018.py deleted file mode 100644 index 4056767bf..000000000 --- a/src/reminders/migrations/0002_auto_20180824_2018.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.1 on 2018-08-24 20:18 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('reminders', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='reminder', - name='document', - field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='documents.Document'), - ), - ] From efc57852d1ac2968ea29afd233bd89c66329e99b Mon Sep 17 00:00:00 2001 From: dadosch Date: Wed, 29 Aug 2018 00:37:07 +0200 Subject: [PATCH 7/9] remove atomic=False where it is obviously not needed) --- src/documents/migrations/0003_sender.py | 1 - src/documents/migrations/0012_auto_20160305_0040.py | 1 - src/documents/migrations/0014_document_checksum.py | 1 - src/documents/migrations/0019_add_consumer_user.py | 1 - src/documents/migrations/0020_document_added.py | 1 - 5 files changed, 5 deletions(-) diff --git a/src/documents/migrations/0003_sender.py b/src/documents/migrations/0003_sender.py index d3aad9903..27eead032 100644 --- a/src/documents/migrations/0003_sender.py +++ b/src/documents/migrations/0003_sender.py @@ -32,7 +32,6 @@ def realign_senders(apps, schema_editor): class Migration(migrations.Migration): - atomic = False dependencies = [ ('documents', '0002_auto_20151226_1316'), ] diff --git a/src/documents/migrations/0012_auto_20160305_0040.py b/src/documents/migrations/0012_auto_20160305_0040.py index f1659f4a1..a0b4b27af 100644 --- a/src/documents/migrations/0012_auto_20160305_0040.py +++ b/src/documents/migrations/0012_auto_20160305_0040.py @@ -112,7 +112,6 @@ def move_documents_and_create_thumbnails(apps, schema_editor): class Migration(migrations.Migration): - atomic = False dependencies = [ ('documents', '0011_auto_20160303_1929'), ] diff --git a/src/documents/migrations/0014_document_checksum.py b/src/documents/migrations/0014_document_checksum.py index b58b9ebc1..bc563cf86 100644 --- a/src/documents/migrations/0014_document_checksum.py +++ b/src/documents/migrations/0014_document_checksum.py @@ -128,7 +128,6 @@ def do_nothing(apps, schema_editor): class Migration(migrations.Migration): - atomic = False dependencies = [ ('documents', '0013_auto_20160325_2111'), ] diff --git a/src/documents/migrations/0019_add_consumer_user.py b/src/documents/migrations/0019_add_consumer_user.py index 82670e53f..bc52ae7f6 100644 --- a/src/documents/migrations/0019_add_consumer_user.py +++ b/src/documents/migrations/0019_add_consumer_user.py @@ -15,7 +15,6 @@ def reverse_func(apps, schema_editor): class Migration(migrations.Migration): - atomic = False dependencies = [ ('documents', '0018_auto_20170715_1712'), ] diff --git a/src/documents/migrations/0020_document_added.py b/src/documents/migrations/0020_document_added.py index 485c04671..d5b53a051 100644 --- a/src/documents/migrations/0020_document_added.py +++ b/src/documents/migrations/0020_document_added.py @@ -12,7 +12,6 @@ def set_added_time_to_created_time(apps, schema_editor): doc.save() class Migration(migrations.Migration): - atomic = False dependencies = [ ('documents', '0019_add_consumer_user'), ] From efb015733796e58be5cc01359f04b6ee4325f8ad Mon Sep 17 00:00:00 2001 From: dadosch Date: Fri, 31 Aug 2018 00:04:02 +0200 Subject: [PATCH 8/9] add fix for messed up html at reminders, thanks to @brookst --- src/documents/admin.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/documents/admin.py b/src/documents/admin.py index 534f9143b..4143ef2a1 100644 --- a/src/documents/admin.py +++ b/src/documents/admin.py @@ -8,6 +8,8 @@ try: except ImportError: from django.urls import reverse from django.templatetags.static import static +from django.utils.safestring import mark_safe +from django.utils.html import format_html, format_html_join from .models import Correspondent, Tag, Document, Log @@ -180,7 +182,7 @@ class DocumentAdmin(CommonAdmin): ) } ) - return r + return mark_safe(r) tags_.allow_tags = True def document(self, obj): @@ -201,15 +203,14 @@ class DocumentAdmin(CommonAdmin): @staticmethod def _html_tag(kind, inside=None, **kwargs): - attributes = [] - for lft, rgt in kwargs.items(): - attributes.append('{}="{}"'.format(lft, rgt)) + attributes = format_html_join(' ', '{}="{}"', kwargs.items()) if inside is not None: - return "<{kind} {attributes}>{inside}".format( - kind=kind, attributes=" ".join(attributes), inside=inside) + return format_html("<{kind} {attributes}>{inside}", + kind=kind, attributes=attributes, inside=inside) - return "<{} {}/>".format(kind, " ".join(attributes)) + + return format_html("<{} {}/>", kind, attributes) class LogAdmin(CommonAdmin): From ec862ed5261e40ddf31dab320477a6db15b42d77 Mon Sep 17 00:00:00 2001 From: dadosch Date: Fri, 31 Aug 2018 00:17:48 +0200 Subject: [PATCH 9/9] make pycodestyle happy... --- src/documents/admin.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/documents/admin.py b/src/documents/admin.py index 4143ef2a1..7a6f3c368 100644 --- a/src/documents/admin.py +++ b/src/documents/admin.py @@ -202,13 +202,11 @@ class DocumentAdmin(CommonAdmin): @staticmethod def _html_tag(kind, inside=None, **kwargs): - - attributes = format_html_join(' ', '{}="{}"', kwargs.items()) + attributes = format_html_join(' ', '{}="{}"', kwargs.items()) if inside is not None: return format_html("<{kind} {attributes}>{inside}", - kind=kind, attributes=attributes, inside=inside) - + kind=kind, attributes=attributes, inside=inside) return format_html("<{} {}/>", kind, attributes)