From 72e9344131a10a2869a9c9a267c10c57ae1c21ab Mon Sep 17 00:00:00 2001 From: David Reed Date: Mon, 8 Mar 2021 19:20:30 -0700 Subject: [PATCH 1/2] Update preflights and format everything --- .flake8 | 1 + biblia/asgi.py | 2 +- biblia/settings.py | 1 + biblia/urls.py | 4 +- biblia/wsgi.py | 2 +- manage.py | 4 +- package.json | 7 +- requirements_dev.txt | 2 +- src/modules/bib/addVolume/addVolume.js | 11 +- .../bib/translationView/translationView.js | 25 +- translations/admin.py | 13 +- translations/apps.py | 2 +- translations/jobs.py | 4 +- translations/migrations/0001_initial.py | 236 ++++++++++++++---- .../migrations/0002_auto_20200718_2128.py | 18 +- .../migrations/0003_person_middle_name.py | 6 +- .../migrations/0004_auto_20200718_2147.py | 8 +- .../migrations/0005_auto_20200718_2312.py | 37 +-- .../migrations/0006_auto_20200719_1740.py | 10 +- .../migrations/0007_auto_20200719_1751.py | 6 +- .../migrations/0008_auto_20200719_1800.py | 42 +++- .../migrations/0009_auto_20200719_1801.py | 15 +- .../migrations/0010_auto_20200926_1253.py | 103 +++++--- .../migrations/0011_auto_20200929_2059.py | 2 +- .../migrations/0012_auto_20200929_2100.py | 8 +- .../migrations/0013_auto_20201004_1604.py | 20 +- .../migrations/0014_auto_20201004_1816.py | 17 +- .../migrations/0015_auto_20201004_2109.py | 17 +- .../migrations/0016_auto_20201009_2214.py | 36 ++- .../migrations/0017_link_resource_type.py | 16 +- .../migrations/0018_auto_20201010_1043.py | 28 +-- .../0019_feature_has_facing_text.py | 6 +- .../migrations/0020_auto_20201010_1215.py | 6 +- .../migrations/0021_auto_20201011_1451.py | 14 +- .../migrations/0022_auto_20201011_1623.py | 46 ++-- .../migrations/0023_volume_description.py | 6 +- .../migrations/0024_auto_20201107_2252.py | 18 +- .../migrations/0024_auto_20201119_2153.py | 21 +- .../migrations/0025_auto_20201108_1257.py | 22 +- .../migrations/0026_review_recommended.py | 6 +- .../migrations/0027_merge_20201122_1744.py | 7 +- .../migrations/0028_auto_20201125_2018.py | 16 +- .../0029_publishedreview_published_date.py | 6 +- .../migrations/0030_auto_20201128_0904.py | 6 +- .../migrations/0031_auto_20201128_0906.py | 12 +- .../migrations/0032_auto_20201128_0907.py | 6 +- .../migrations/0033_auto_20201128_0914.py | 8 +- .../migrations/0035_auto_20201212_1833.py | 17 +- .../migrations/0037_auto_20210109_2209.py | 72 ++++-- .../migrations/0038_auto_20210109_2212.py | 6 +- .../0039_alternatename_alternate_name_type.py | 16 +- .../migrations/0041_auto_20210110_0950.py | 20 +- .../migrations/0042_auto_20210130_1452.py | 166 +++++++----- .../migrations/0044_auto_20210219_2113.py | 2 +- translations/models.py | 10 +- translations/serializers.py | 21 +- translations/urls.py | 9 +- translations/views.py | 57 ++--- users/apps.py | 2 +- users/forms.py | 2 +- users/migrations/0001_initial.py | 124 +++++++-- users/migrations/0002_auto_20201122_1748.py | 8 +- users/migrations/0003_auto_20201122_2215.py | 12 +- users/migrations/0004_auto_20210109_2209.py | 10 +- users/tests.py | 2 +- users/urls.py | 8 +- users/views.py | 2 +- 67 files changed, 990 insertions(+), 485 deletions(-) diff --git a/.flake8 b/.flake8 index 9027e02..cd601f2 100644 --- a/.flake8 +++ b/.flake8 @@ -6,4 +6,5 @@ exclude = old, build, dist + venv max-line-length = 200 \ No newline at end of file diff --git a/biblia/asgi.py b/biblia/asgi.py index d383201..59bc5ab 100644 --- a/biblia/asgi.py +++ b/biblia/asgi.py @@ -11,6 +11,6 @@ from django.core.asgi import get_asgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'biblia.settings') +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "biblia.settings") application = get_asgi_application() diff --git a/biblia/settings.py b/biblia/settings.py index ab086bd..87403c6 100644 --- a/biblia/settings.py +++ b/biblia/settings.py @@ -11,6 +11,7 @@ """ import os + import dj_database_url import dotenv diff --git a/biblia/urls.py b/biblia/urls.py index 97958c0..4734e04 100644 --- a/biblia/urls.py +++ b/biblia/urls.py @@ -13,10 +13,10 @@ 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ -from django.contrib import admin -from django.urls import path, include from django.conf import settings from django.conf.urls.static import static +from django.contrib import admin +from django.urls import include, path urlpatterns = [ path("", include("translations.urls")), diff --git a/biblia/wsgi.py b/biblia/wsgi.py index 911f691..90f9e73 100644 --- a/biblia/wsgi.py +++ b/biblia/wsgi.py @@ -11,6 +11,6 @@ from django.core.wsgi import get_wsgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'biblia.settings') +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "biblia.settings") application = get_wsgi_application() diff --git a/manage.py b/manage.py index 38b9183..91470df 100755 --- a/manage.py +++ b/manage.py @@ -5,7 +5,7 @@ def main(): - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'biblia.settings') + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "biblia.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: @@ -17,5 +17,5 @@ def main(): execute_from_command_line(sys.argv) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/package.json b/package.json index 276ce1f..b042376 100644 --- a/package.json +++ b/package.json @@ -32,12 +32,13 @@ "license": "MIT", "lint-staged": { "**/*.{css,html,js,json,md,ts,yaml,yml}": [ - "prettier --write" + "npm run prettier:verify" ], "./src/**/*.js": [ "eslint" ], "**/*.py": [ + "isort", "black", "flake8" ] @@ -47,8 +48,8 @@ "build": "lwc-services build -m production -w webpack.config.js", "build:development": "lwc-services build -w webpack.config.js", "lint": "eslint ./src/**/*.js", - "prettier": "prettier --write \"**/*.{css,html,js,json,md,ts,yaml,yml}\"", - "prettier:verify": "prettier --list-different \"**/*.{css,html,js,json,md,ts,yaml,yml}\"", + "prettier": "prettier --write \"**/*.{css,js,json,md,ts,yaml,yml}\"", + "prettier:verify": "prettier --list-different \"**/*.{css,js,json,md,ts,yaml,yml}\"", "test:unit": "lwc-services test:unit", "test:unit:coverage": "lwc-services test:unit --coverage", "test:unit:debug": "lwc-services test:unit --debug", diff --git a/requirements_dev.txt b/requirements_dev.txt index c07af36..5e5647a 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,3 +1,3 @@ black flake8 -isort \ No newline at end of file +isort diff --git a/src/modules/bib/addVolume/addVolume.js b/src/modules/bib/addVolume/addVolume.js index 573b396..767dda3 100644 --- a/src/modules/bib/addVolume/addVolume.js +++ b/src/modules/bib/addVolume/addVolume.js @@ -1,5 +1,10 @@ import { LightningElement, track } from 'lwc'; -import { createRecord, getRecordUiUrl, getRecordApiUrl, getRecordsFromApi } from 'bib/drf'; +import { + createRecord, + getRecordUiUrl, + getRecordApiUrl, + getRecordsFromApi +} from 'bib/drf'; import { Feature } from 'bib/feature'; export default class AddVolume extends LightningElement { @@ -44,8 +49,8 @@ export default class AddVolume extends LightningElement { async connectedCallback() { // Start async loads of data from DRF to improve responsiveness. - await getRecordsFromApi("persons"); - await getRecordsFromApi("texts"); + await getRecordsFromApi('persons'); + await getRecordsFromApi('texts'); } // Change Handlers diff --git a/src/modules/bib/translationView/translationView.js b/src/modules/bib/translationView/translationView.js index c3bfc93..2ad50a3 100644 --- a/src/modules/bib/translationView/translationView.js +++ b/src/modules/bib/translationView/translationView.js @@ -112,7 +112,7 @@ export default class TranslationView extends LightningElement { let seen = new Set(); let languages = []; - this.records.forEach(r => { + this.records.forEach((r) => { if (!seen.has(r.language.id)) { languages.push(r.language); seen.add(r.language.id); @@ -132,7 +132,7 @@ export default class TranslationView extends LightningElement { if (textIdMatch && textIdMatch.length === 2) { this.translationPath = `texts/${textIdMatch[1]}/translations`; } else { - this._error = "No text found"; + this._error = 'No text found'; } } @@ -156,25 +156,30 @@ export default class TranslationView extends LightningElement { // This is a feature checkbox feature = `feature_${event.target.dataset.feature}`; required = event.target.checked; - } else if (event.target.name === "format") { - feature = "kind"; + } else if (event.target.name === 'format') { + feature = 'kind'; required = this.selectedFilterFormat = event.target.value; - } else if (event.target.name === "language") { - feature = "language.id"; + } else if (event.target.name === 'language') { + feature = 'language.id'; this.selectedFilterLanguage = event.target.value; required = Number(this.selectedFilterLanguage); - } else if (event.target.name === "coverage") { - feature = "partial" + } else if (event.target.name === 'coverage') { + feature = 'partial'; this.selectedFilterCoverage = event.target.value; if (this.selectedFilterCoverage) { - required = this.selectedFilterCoverage === "Partial"; + required = this.selectedFilterCoverage === 'Partial'; } } this.filterCriteria = new FilterCriteria( this.filterCriteria.filters .filter((f) => f.column !== feature) - .concat((required || (feature === "partial" && this.selectedFilterCoverage)) ? [{ column: feature, value: required }] : []), + .concat( + required || + (feature === 'partial' && this.selectedFilterCoverage) + ? [{ column: feature, value: required }] + : [] + ), this.filterCriteria.sortColumn, this.filterCriteria.sortAscending ); diff --git a/translations/admin.py b/translations/admin.py index e77b8ee..5508070 100644 --- a/translations/admin.py +++ b/translations/admin.py @@ -1,18 +1,19 @@ from django.contrib import admin from django.contrib.contenttypes.admin import GenericTabularInline + from .models import ( + AlternateName, + Feature, Language, - Volume, + Link, Person, - Feature, - SourceText, + PublishedReview, Publisher, Review, - PublishedReview, Series, - Link, - AlternateName, + SourceText, UserSubmission, + Volume, ) for model in [Language, Review, Series, UserSubmission]: diff --git a/translations/apps.py b/translations/apps.py index 0e22fe7..d7f6ed4 100644 --- a/translations/apps.py +++ b/translations/apps.py @@ -2,4 +2,4 @@ class TranslationsConfig(AppConfig): - name = 'translations' + name = "translations" diff --git a/translations/jobs.py b/translations/jobs.py index 7ecf8b8..7c1a7ee 100644 --- a/translations/jobs.py +++ b/translations/jobs.py @@ -1,7 +1,7 @@ -from .models import Link - import requests +from .models import Link + def remove_dead_links(): to_delete = [] diff --git a/translations/migrations/0001_initial.py b/translations/migrations/0001_initial.py index 1e81148..e7e8c22 100644 --- a/translations/migrations/0001_initial.py +++ b/translations/migrations/0001_initial.py @@ -1,97 +1,239 @@ # Generated by Django 3.0.8 on 2020-07-19 03:11 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='Language', + name="Language", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=255)), ], ), migrations.CreateModel( - name='Person', + name="Person", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('first_name', models.CharField(max_length=255)), - ('last_name', models.CharField(max_length=255)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("first_name", models.CharField(max_length=255)), + ("last_name", models.CharField(max_length=255)), ], ), migrations.CreateModel( - name='PersonRole', + name="PersonRole", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('role', models.CharField(choices=[('ED', 'Editor'), ('AU', 'Author'), ('IN', 'Introducer')], max_length=2)), - ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='translations.Person')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "role", + models.CharField( + choices=[ + ("ED", "Editor"), + ("AU", "Author"), + ("IN", "Introducer"), + ], + max_length=2, + ), + ), + ( + "person", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="translations.Person", + ), + ), ], ), migrations.CreateModel( - name='Publisher', + name="Publisher", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=255)), ], ), migrations.CreateModel( - name='SourceText', + name="SourceText", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=255)), - ('original_language_title', models.CharField(max_length=255)), - ('author', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='translations.Person')), - ('language', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='translations.Language')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("title", models.CharField(max_length=255)), + ("original_language_title", models.CharField(max_length=255)), + ( + "author", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="translations.Person", + ), + ), + ( + "language", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="translations.Language", + ), + ), ], ), migrations.CreateModel( - name='Volume', + name="Volume", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=255)), - ('isbn', models.CharField(max_length=32)), - ('people', models.ManyToManyField(through='translations.PersonRole', to='translations.Person')), - ('publisher', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='translations.Publisher')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("title", models.CharField(max_length=255)), + ("isbn", models.CharField(max_length=32)), + ( + "people", + models.ManyToManyField( + through="translations.PersonRole", to="translations.Person" + ), + ), + ( + "publisher", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="translations.Publisher", + ), + ), ], ), migrations.CreateModel( - name='Translation', + name="Translation", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('authors', models.ManyToManyField(to='translations.Person')), - ('language', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='translations.Language')), - ('publications', models.ManyToManyField(to='translations.Volume')), - ('source_text', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='translations.SourceText')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("authors", models.ManyToManyField(to="translations.Person")), + ( + "language", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="translations.Language", + ), + ), + ("publications", models.ManyToManyField(to="translations.Volume")), + ( + "source_text", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="translations.SourceText", + ), + ), ], ), migrations.CreateModel( - name='Review', + name="Review", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('content', models.TextField()), - ('volume', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='translations.Volume')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("content", models.TextField()), + ( + "volume", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="translations.Volume", + ), + ), ], ), migrations.CreateModel( - name='PublishedReview', + name="PublishedReview", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('url', models.URLField()), - ('author', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='translations.Person')), - ('volume', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='translations.Volume')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("url", models.URLField()), + ( + "author", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="translations.Person", + ), + ), + ( + "volume", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="translations.Volume", + ), + ), ], ), migrations.AddField( - model_name='personrole', - name='volume', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='translations.Volume'), + model_name="personrole", + name="volume", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="translations.Volume" + ), ), ] diff --git a/translations/migrations/0002_auto_20200718_2128.py b/translations/migrations/0002_auto_20200718_2128.py index 0a8305c..9135435 100644 --- a/translations/migrations/0002_auto_20200718_2128.py +++ b/translations/migrations/0002_auto_20200718_2128.py @@ -6,28 +6,28 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0001_initial'), + ("translations", "0001_initial"), ] operations = [ migrations.AddField( - model_name='person', - name='sole_name', + model_name="person", + name="sole_name", field=models.CharField(blank=True, max_length=255), ), migrations.AddField( - model_name='translation', - name='title', + model_name="translation", + name="title", field=models.CharField(blank=True, max_length=255), ), migrations.AlterField( - model_name='person', - name='first_name', + model_name="person", + name="first_name", field=models.CharField(blank=True, max_length=255), ), migrations.AlterField( - model_name='person', - name='last_name', + model_name="person", + name="last_name", field=models.CharField(blank=True, max_length=255), ), ] diff --git a/translations/migrations/0003_person_middle_name.py b/translations/migrations/0003_person_middle_name.py index 0fda909..21ac5d5 100644 --- a/translations/migrations/0003_person_middle_name.py +++ b/translations/migrations/0003_person_middle_name.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0002_auto_20200718_2128'), + ("translations", "0002_auto_20200718_2128"), ] operations = [ migrations.AddField( - model_name='person', - name='middle_name', + model_name="person", + name="middle_name", field=models.CharField(blank=True, max_length=255), ), ] diff --git a/translations/migrations/0004_auto_20200718_2147.py b/translations/migrations/0004_auto_20200718_2147.py index 2566dc8..505911f 100644 --- a/translations/migrations/0004_auto_20200718_2147.py +++ b/translations/migrations/0004_auto_20200718_2147.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0003_person_middle_name'), + ("translations", "0003_person_middle_name"), ] operations = [ migrations.AlterField( - model_name='translation', - name='publications', - field=models.ManyToManyField(blank=True, to='translations.Volume'), + model_name="translation", + name="publications", + field=models.ManyToManyField(blank=True, to="translations.Volume"), ), ] diff --git a/translations/migrations/0005_auto_20200718_2312.py b/translations/migrations/0005_auto_20200718_2312.py index 17c63b2..77d4d09 100644 --- a/translations/migrations/0005_auto_20200718_2312.py +++ b/translations/migrations/0005_auto_20200718_2312.py @@ -1,42 +1,49 @@ # Generated by Django 3.0.8 on 2020-07-19 05:12 import datetime -from django.db import migrations, models + import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('translations', '0004_auto_20200718_2147'), + ("translations", "0004_auto_20200718_2147"), ] operations = [ migrations.AddField( - model_name='publisher', - name='description', + model_name="publisher", + name="description", field=models.TextField(blank=True), ), migrations.AddField( - model_name='publisher', - name='website', + model_name="publisher", + name="website", field=models.URLField(blank=True), ), migrations.AddField( - model_name='review', - name='title', - field=models.CharField(default='Test', max_length=255), + model_name="review", + name="title", + field=models.CharField(default="Test", max_length=255), preserve_default=False, ), migrations.AddField( - model_name='volume', - name='published_date', - field=models.DateField(blank=True, default=datetime.datetime(2020, 7, 18, 23, 12, 13, 589431)), + model_name="volume", + name="published_date", + field=models.DateField( + blank=True, default=datetime.datetime(2020, 7, 18, 23, 12, 13, 589431) + ), preserve_default=False, ), migrations.AlterField( - model_name='publishedreview', - name='volume', - field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='translations.Volume'), + model_name="publishedreview", + name="volume", + field=models.ForeignKey( + blank=True, + on_delete=django.db.models.deletion.CASCADE, + to="translations.Volume", + ), ), ] diff --git a/translations/migrations/0006_auto_20200719_1740.py b/translations/migrations/0006_auto_20200719_1740.py index ece643c..6ed7625 100644 --- a/translations/migrations/0006_auto_20200719_1740.py +++ b/translations/migrations/0006_auto_20200719_1740.py @@ -6,18 +6,18 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0005_auto_20200718_2312'), + ("translations", "0005_auto_20200718_2312"), ] operations = [ migrations.AddField( - model_name='translation', - name='description', + model_name="translation", + name="description", field=models.TextField(blank=True), ), migrations.AddField( - model_name='translation', - name='partial', + model_name="translation", + name="partial", field=models.BooleanField(default=False), preserve_default=False, ), diff --git a/translations/migrations/0007_auto_20200719_1751.py b/translations/migrations/0007_auto_20200719_1751.py index 35faae5..abb0230 100644 --- a/translations/migrations/0007_auto_20200719_1751.py +++ b/translations/migrations/0007_auto_20200719_1751.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0006_auto_20200719_1740'), + ("translations", "0006_auto_20200719_1740"), ] operations = [ migrations.AlterField( - model_name='volume', - name='isbn', + model_name="volume", + name="isbn", field=models.CharField(blank=True, max_length=32), ), ] diff --git a/translations/migrations/0008_auto_20200719_1800.py b/translations/migrations/0008_auto_20200719_1800.py index feb623a..1d446c2 100644 --- a/translations/migrations/0008_auto_20200719_1800.py +++ b/translations/migrations/0008_auto_20200719_1800.py @@ -1,31 +1,51 @@ # Generated by Django 3.0.8 on 2020-07-20 00:00 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('translations', '0007_auto_20200719_1751'), + ("translations", "0007_auto_20200719_1751"), ] operations = [ migrations.CreateModel( - name='Series', + name="Series", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=255)), ], ), migrations.AlterField( - model_name='personrole', - name='role', - field=models.CharField(choices=[('ED', 'Editor'), ('AU', 'Author'), ('IN', 'Introducer'), ('CM', 'Commentator')], max_length=2), + model_name="personrole", + name="role", + field=models.CharField( + choices=[ + ("ED", "Editor"), + ("AU", "Author"), + ("IN", "Introducer"), + ("CM", "Commentator"), + ], + max_length=2, + ), ), migrations.AddField( - model_name='volume', - name='series', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='translations.Series'), + model_name="volume", + name="series", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + to="translations.Series", + ), ), ] diff --git a/translations/migrations/0009_auto_20200719_1801.py b/translations/migrations/0009_auto_20200719_1801.py index de28d4a..8ed05e3 100644 --- a/translations/migrations/0009_auto_20200719_1801.py +++ b/translations/migrations/0009_auto_20200719_1801.py @@ -1,19 +1,24 @@ # Generated by Django 3.0.8 on 2020-07-20 00:01 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('translations', '0008_auto_20200719_1800'), + ("translations", "0008_auto_20200719_1800"), ] operations = [ migrations.AlterField( - model_name='volume', - name='series', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='translations.Series'), + model_name="volume", + name="series", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + to="translations.Series", + ), ), ] diff --git a/translations/migrations/0010_auto_20200926_1253.py b/translations/migrations/0010_auto_20200926_1253.py index 7057deb..7137433 100644 --- a/translations/migrations/0010_auto_20200926_1253.py +++ b/translations/migrations/0010_auto_20200926_1253.py @@ -1,82 +1,111 @@ # Generated by Django 3.0.8 on 2020-09-26 18:53 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('translations', '0009_auto_20200719_1801'), + ("translations", "0009_auto_20200719_1801"), ] operations = [ migrations.CreateModel( - name='Feature', + name="Feature", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('feature', models.CharField(choices=[('ED', 'Edited by'), ('IN', 'Introduction by'), ('CM', 'Commentary by'), ('NT', 'Notes by'), ('TR', 'Translation by')], max_length=2)), - ('description', models.TextField(blank=True)), - ('kind', models.TextField(choices=[('PR', 'Prose'), ('VR', 'Verse')])), - ('partial', models.BooleanField()), - ('title', models.CharField(blank=True, max_length=255)), - ('persons', models.ManyToManyField(to='translations.Person')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "feature", + models.CharField( + choices=[ + ("ED", "Edited by"), + ("IN", "Introduction by"), + ("CM", "Commentary by"), + ("NT", "Notes by"), + ("TR", "Translation by"), + ], + max_length=2, + ), + ), + ("description", models.TextField(blank=True)), + ("kind", models.TextField(choices=[("PR", "Prose"), ("VR", "Verse")])), + ("partial", models.BooleanField()), + ("title", models.CharField(blank=True, max_length=255)), + ("persons", models.ManyToManyField(to="translations.Person")), ], ), migrations.RemoveField( - model_name='translation', - name='authors', + model_name="translation", + name="authors", ), migrations.RemoveField( - model_name='translation', - name='language', + model_name="translation", + name="language", ), migrations.RemoveField( - model_name='translation', - name='publications', + model_name="translation", + name="publications", ), migrations.RemoveField( - model_name='translation', - name='source_text', + model_name="translation", + name="source_text", ), migrations.AlterModelOptions( - name='series', - options={'verbose_name_plural': 'series'}, + name="series", + options={"verbose_name_plural": "series"}, ), migrations.RemoveField( - model_name='volume', - name='people', + model_name="volume", + name="people", ), migrations.AddField( - model_name='sourcetext', - name='date', + model_name="sourcetext", + name="date", field=models.CharField(blank=True, max_length=255), ), migrations.AddField( - model_name='sourcetext', - name='description', + model_name="sourcetext", + name="description", field=models.TextField(blank=True), ), migrations.AddField( - model_name='sourcetext', - name='kind', - field=models.TextField(choices=[('PR', 'Prose'), ('VR', 'Verse')], default='VR'), + model_name="sourcetext", + name="kind", + field=models.TextField( + choices=[("PR", "Prose"), ("VR", "Verse")], default="VR" + ), preserve_default=False, ), migrations.DeleteModel( - name='PersonRole', + name="PersonRole", ), migrations.DeleteModel( - name='Translation', + name="Translation", ), migrations.AddField( - model_name='feature', - name='source_text', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='translations.SourceText'), + model_name="feature", + name="source_text", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + to="translations.SourceText", + ), ), migrations.AddField( - model_name='feature', - name='volumes', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='translations.Volume'), + model_name="feature", + name="volumes", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="translations.Volume" + ), ), ] diff --git a/translations/migrations/0011_auto_20200929_2059.py b/translations/migrations/0011_auto_20200929_2059.py index 30444a8..db6d3b5 100644 --- a/translations/migrations/0011_auto_20200929_2059.py +++ b/translations/migrations/0011_auto_20200929_2059.py @@ -1,7 +1,7 @@ # Generated by Django 3.0.8 on 2020-09-30 02:59 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/translations/migrations/0012_auto_20200929_2100.py b/translations/migrations/0012_auto_20200929_2100.py index ceb648b..82f885c 100644 --- a/translations/migrations/0012_auto_20200929_2100.py +++ b/translations/migrations/0012_auto_20200929_2100.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0011_auto_20200929_2059'), + ("translations", "0011_auto_20200929_2059"), ] operations = [ migrations.RenameField( - model_name='feature', - old_name='volumes', - new_name='volume', + model_name="feature", + old_name="volumes", + new_name="volume", ), ] diff --git a/translations/migrations/0013_auto_20201004_1604.py b/translations/migrations/0013_auto_20201004_1604.py index 407ba56..3ca5585 100644 --- a/translations/migrations/0013_auto_20201004_1604.py +++ b/translations/migrations/0013_auto_20201004_1604.py @@ -6,18 +6,26 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0012_auto_20200929_2100'), + ("translations", "0012_auto_20200929_2100"), ] operations = [ migrations.AddField( - model_name='person', - name='description', + model_name="person", + name="description", field=models.TextField(blank=True), ), migrations.AlterField( - model_name='feature', - name='feature', - field=models.CharField(choices=[('ED', 'Edited by'), ('IN', 'Introduction by'), ('CM', 'Commentary by'), ('TR', 'Translation by')], max_length=2), + model_name="feature", + name="feature", + field=models.CharField( + choices=[ + ("ED", "Edited by"), + ("IN", "Introduction by"), + ("CM", "Commentary by"), + ("TR", "Translation by"), + ], + max_length=2, + ), ), ] diff --git a/translations/migrations/0014_auto_20201004_1816.py b/translations/migrations/0014_auto_20201004_1816.py index 81370fe..54f76e4 100644 --- a/translations/migrations/0014_auto_20201004_1816.py +++ b/translations/migrations/0014_auto_20201004_1816.py @@ -6,13 +6,22 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0013_auto_20201004_1604'), + ("translations", "0013_auto_20201004_1604"), ] operations = [ migrations.AlterField( - model_name='feature', - name='feature', - field=models.CharField(choices=[('ED', 'Edited by'), ('IN', 'Introduction by'), ('CM', 'Commentary by'), ('TR', 'Translation by'), ('NT', 'Notes by')], max_length=2), + model_name="feature", + name="feature", + field=models.CharField( + choices=[ + ("ED", "Edited by"), + ("IN", "Introduction by"), + ("CM", "Commentary by"), + ("TR", "Translation by"), + ("NT", "Notes by"), + ], + max_length=2, + ), ), ] diff --git a/translations/migrations/0015_auto_20201004_2109.py b/translations/migrations/0015_auto_20201004_2109.py index 34fc204..af6f1c6 100644 --- a/translations/migrations/0015_auto_20201004_2109.py +++ b/translations/migrations/0015_auto_20201004_2109.py @@ -6,13 +6,22 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0014_auto_20201004_1816'), + ("translations", "0014_auto_20201004_1816"), ] operations = [ migrations.AlterField( - model_name='feature', - name='feature', - field=models.CharField(choices=[('ED', 'Edited'), ('IN', 'Introduction'), ('CM', 'Commentary'), ('TR', 'Translation'), ('NT', 'Notes')], max_length=2), + model_name="feature", + name="feature", + field=models.CharField( + choices=[ + ("ED", "Edited"), + ("IN", "Introduction"), + ("CM", "Commentary"), + ("TR", "Translation"), + ("NT", "Notes"), + ], + max_length=2, + ), ), ] diff --git a/translations/migrations/0016_auto_20201009_2214.py b/translations/migrations/0016_auto_20201009_2214.py index 1269404..a68d375 100644 --- a/translations/migrations/0016_auto_20201009_2214.py +++ b/translations/migrations/0016_auto_20201009_2214.py @@ -1,29 +1,43 @@ # Generated by Django 3.0.8 on 2020-10-10 04:14 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('contenttypes', '0002_remove_content_type_name'), - ('translations', '0015_auto_20201004_2109'), + ("contenttypes", "0002_remove_content_type_name"), + ("translations", "0015_auto_20201004_2109"), ] operations = [ migrations.RemoveField( - model_name='publisher', - name='website', + model_name="publisher", + name="website", ), migrations.CreateModel( - name='Link', + name="Link", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('object_id', models.PositiveIntegerField()), - ('link', models.URLField()), - ('source', models.CharField(max_length=255)), - ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("object_id", models.PositiveIntegerField()), + ("link", models.URLField()), + ("source", models.CharField(max_length=255)), + ( + "content_type", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="contenttypes.ContentType", + ), + ), ], ), ] diff --git a/translations/migrations/0017_link_resource_type.py b/translations/migrations/0017_link_resource_type.py index 1807025..d9bd97a 100644 --- a/translations/migrations/0017_link_resource_type.py +++ b/translations/migrations/0017_link_resource_type.py @@ -6,14 +6,22 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0016_auto_20201009_2214'), + ("translations", "0016_auto_20201009_2214"), ] operations = [ migrations.AddField( - model_name='link', - name='resource_type', - field=models.TextField(choices=[('FT', 'Full Text'), ('WS', 'Website'), ('BO', 'Bio'), ('RS', 'Resources')], default='WS'), + model_name="link", + name="resource_type", + field=models.TextField( + choices=[ + ("FT", "Full Text"), + ("WS", "Website"), + ("BO", "Bio"), + ("RS", "Resources"), + ], + default="WS", + ), preserve_default=False, ), ] diff --git a/translations/migrations/0018_auto_20201010_1043.py b/translations/migrations/0018_auto_20201010_1043.py index 1f5f3cf..c8687bf 100644 --- a/translations/migrations/0018_auto_20201010_1043.py +++ b/translations/migrations/0018_auto_20201010_1043.py @@ -6,33 +6,33 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0017_link_resource_type'), + ("translations", "0017_link_resource_type"), ] operations = [ migrations.RemoveField( - model_name='publishedreview', - name='author', + model_name="publishedreview", + name="author", ), migrations.RemoveField( - model_name='publishedreview', - name='url', + model_name="publishedreview", + name="url", ), migrations.AddField( - model_name='publishedreview', - name='location', - field=models.CharField(default='Unknown', max_length=255), + model_name="publishedreview", + name="location", + field=models.CharField(default="Unknown", max_length=255), preserve_default=False, ), migrations.AddField( - model_name='publishedreview', - name='persons', - field=models.ManyToManyField(to='translations.Person'), + model_name="publishedreview", + name="persons", + field=models.ManyToManyField(to="translations.Person"), ), migrations.AddField( - model_name='publishedreview', - name='title', - field=models.CharField(default='Unknown', max_length=255), + model_name="publishedreview", + name="title", + field=models.CharField(default="Unknown", max_length=255), preserve_default=False, ), ] diff --git a/translations/migrations/0019_feature_has_facing_text.py b/translations/migrations/0019_feature_has_facing_text.py index 5415e11..2e98562 100644 --- a/translations/migrations/0019_feature_has_facing_text.py +++ b/translations/migrations/0019_feature_has_facing_text.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0018_auto_20201010_1043'), + ("translations", "0018_auto_20201010_1043"), ] operations = [ migrations.AddField( - model_name='feature', - name='has_facing_text', + model_name="feature", + name="has_facing_text", field=models.BooleanField(default=False), preserve_default=False, ), diff --git a/translations/migrations/0020_auto_20201010_1215.py b/translations/migrations/0020_auto_20201010_1215.py index 70ae20c..a0cadfa 100644 --- a/translations/migrations/0020_auto_20201010_1215.py +++ b/translations/migrations/0020_auto_20201010_1215.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0019_feature_has_facing_text'), + ("translations", "0019_feature_has_facing_text"), ] operations = [ migrations.AlterField( - model_name='publishedreview', - name='title', + model_name="publishedreview", + name="title", field=models.CharField(blank=True, max_length=255), ), ] diff --git a/translations/migrations/0021_auto_20201011_1451.py b/translations/migrations/0021_auto_20201011_1451.py index a874bf3..5c49da4 100644 --- a/translations/migrations/0021_auto_20201011_1451.py +++ b/translations/migrations/0021_auto_20201011_1451.py @@ -6,21 +6,21 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0020_auto_20201010_1215'), + ("translations", "0020_auto_20201010_1215"), ] operations = [ migrations.AlterModelOptions( - name='link', - options={'ordering': ['resource_type']}, + name="link", + options={"ordering": ["resource_type"]}, ), migrations.AlterModelOptions( - name='sourcetext', - options={'ordering': ['title']}, + name="sourcetext", + options={"ordering": ["title"]}, ), migrations.AddField( - model_name='volume', - name='oclc_number', + model_name="volume", + name="oclc_number", field=models.CharField(blank=True, max_length=32), ), ] diff --git a/translations/migrations/0022_auto_20201011_1623.py b/translations/migrations/0022_auto_20201011_1623.py index aa13fba..34c043c 100644 --- a/translations/migrations/0022_auto_20201011_1623.py +++ b/translations/migrations/0022_auto_20201011_1623.py @@ -6,41 +6,51 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0021_auto_20201011_1451'), + ("translations", "0021_auto_20201011_1451"), ] operations = [ migrations.AlterModelOptions( - name='feature', - options={'ordering': ['volume', 'source_text', 'feature']}, + name="feature", + options={"ordering": ["volume", "source_text", "feature"]}, ), migrations.AlterModelOptions( - name='language', - options={'ordering': ['name']}, + name="language", + options={"ordering": ["name"]}, ), migrations.AlterModelOptions( - name='person', - options={'ordering': ['sole_name', 'last_name', 'first_name', 'middle_name']}, + name="person", + options={ + "ordering": ["sole_name", "last_name", "first_name", "middle_name"] + }, ), migrations.AlterModelOptions( - name='publishedreview', - options={'ordering': ['title']}, + name="publishedreview", + options={"ordering": ["title"]}, ), migrations.AlterModelOptions( - name='publisher', - options={'ordering': ['name']}, + name="publisher", + options={"ordering": ["name"]}, ), migrations.AlterModelOptions( - name='series', - options={'ordering': ['name'], 'verbose_name_plural': 'series'}, + name="series", + options={"ordering": ["name"], "verbose_name_plural": "series"}, ), migrations.AlterModelOptions( - name='volume', - options={'ordering': ['title']}, + name="volume", + options={"ordering": ["title"]}, ), migrations.AlterField( - model_name='link', - name='resource_type', - field=models.TextField(choices=[('CO', 'Get a Copy'), ('FT', 'Full Text'), ('WS', 'Website'), ('BO', 'Bio'), ('RS', 'Resources')]), + model_name="link", + name="resource_type", + field=models.TextField( + choices=[ + ("CO", "Get a Copy"), + ("FT", "Full Text"), + ("WS", "Website"), + ("BO", "Bio"), + ("RS", "Resources"), + ] + ), ), ] diff --git a/translations/migrations/0023_volume_description.py b/translations/migrations/0023_volume_description.py index 9c5fe37..d324624 100644 --- a/translations/migrations/0023_volume_description.py +++ b/translations/migrations/0023_volume_description.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0022_auto_20201011_1623'), + ("translations", "0022_auto_20201011_1623"), ] operations = [ migrations.AddField( - model_name='volume', - name='description', + model_name="volume", + name="description", field=models.TextField(blank=True), ), ] diff --git a/translations/migrations/0024_auto_20201107_2252.py b/translations/migrations/0024_auto_20201107_2252.py index 5965414..b8c4db3 100644 --- a/translations/migrations/0024_auto_20201107_2252.py +++ b/translations/migrations/0024_auto_20201107_2252.py @@ -1,27 +1,31 @@ # Generated by Django 3.0.8 on 2020-11-08 05:52 +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('translations', '0023_volume_description'), + ("translations", "0023_volume_description"), ] operations = [ migrations.AddField( - model_name='review', - name='user', - field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + model_name="review", + name="user", + field=models.ForeignKey( + default=None, + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), preserve_default=False, ), migrations.AlterField( - model_name='review', - name='title', + model_name="review", + name="title", field=models.CharField(blank=True, max_length=255), ), ] diff --git a/translations/migrations/0024_auto_20201119_2153.py b/translations/migrations/0024_auto_20201119_2153.py index 74f2eef..fa2ce8f 100644 --- a/translations/migrations/0024_auto_20201119_2153.py +++ b/translations/migrations/0024_auto_20201119_2153.py @@ -1,18 +1,31 @@ # Generated by Django 3.0.8 on 2020-11-20 04:53 -from django.db import migrations import django.db.models.expressions +from django.db import migrations class Migration(migrations.Migration): dependencies = [ - ('translations', '0023_volume_description'), + ("translations", "0023_volume_description"), ] operations = [ migrations.AlterModelOptions( - name='person', - options={'ordering': [django.db.models.expressions.Case(django.db.models.expressions.When(sole_name='', then='last_name'), django.db.models.expressions.When(last_name='', then='sole_name')), 'first_name', 'middle_name']}, + name="person", + options={ + "ordering": [ + django.db.models.expressions.Case( + django.db.models.expressions.When( + sole_name="", then="last_name" + ), + django.db.models.expressions.When( + last_name="", then="sole_name" + ), + ), + "first_name", + "middle_name", + ] + }, ), ] diff --git a/translations/migrations/0025_auto_20201108_1257.py b/translations/migrations/0025_auto_20201108_1257.py index 5790194..1a5e02b 100644 --- a/translations/migrations/0025_auto_20201108_1257.py +++ b/translations/migrations/0025_auto_20201108_1257.py @@ -6,18 +6,26 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0024_auto_20201107_2252'), + ("translations", "0024_auto_20201107_2252"), ] operations = [ migrations.AddField( - model_name='review', - name='closeness_rating', - field=models.IntegerField(blank=True, choices=[(1, 'Low'), (2, 'Average'), (3, 'Excellent')], null=True), + model_name="review", + name="closeness_rating", + field=models.IntegerField( + blank=True, + choices=[(1, "Low"), (2, "Average"), (3, "Excellent")], + null=True, + ), ), migrations.AddField( - model_name='review', - name='readability_rating', - field=models.IntegerField(blank=True, choices=[(1, 'Low'), (2, 'Average'), (3, 'Excellent')], null=True), + model_name="review", + name="readability_rating", + field=models.IntegerField( + blank=True, + choices=[(1, "Low"), (2, "Average"), (3, "Excellent")], + null=True, + ), ), ] diff --git a/translations/migrations/0026_review_recommended.py b/translations/migrations/0026_review_recommended.py index 2437dff..0b9d7c0 100644 --- a/translations/migrations/0026_review_recommended.py +++ b/translations/migrations/0026_review_recommended.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0025_auto_20201108_1257'), + ("translations", "0025_auto_20201108_1257"), ] operations = [ migrations.AddField( - model_name='review', - name='recommended', + model_name="review", + name="recommended", field=models.BooleanField(default=False), preserve_default=False, ), diff --git a/translations/migrations/0027_merge_20201122_1744.py b/translations/migrations/0027_merge_20201122_1744.py index b62c127..c136216 100644 --- a/translations/migrations/0027_merge_20201122_1744.py +++ b/translations/migrations/0027_merge_20201122_1744.py @@ -6,9 +6,8 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0024_auto_20201119_2153'), - ('translations', '0026_review_recommended'), + ("translations", "0024_auto_20201119_2153"), + ("translations", "0026_review_recommended"), ] - operations = [ - ] + operations = [] diff --git a/translations/migrations/0028_auto_20201125_2018.py b/translations/migrations/0028_auto_20201125_2018.py index b4fea41..5cddb2b 100644 --- a/translations/migrations/0028_auto_20201125_2018.py +++ b/translations/migrations/0028_auto_20201125_2018.py @@ -1,24 +1,26 @@ # Generated by Django 3.0.8 on 2020-11-26 03:18 -from django.db import migrations, models import django.utils.timezone +from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('translations', '0027_merge_20201122_1744'), + ("translations", "0027_merge_20201122_1744"), ] operations = [ migrations.AlterModelOptions( - name='review', - options={'ordering': ['-date_created']}, + name="review", + options={"ordering": ["-date_created"]}, ), migrations.AddField( - model_name='review', - name='date_created', - field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + model_name="review", + name="date_created", + field=models.DateTimeField( + auto_now_add=True, default=django.utils.timezone.now + ), preserve_default=False, ), ] diff --git a/translations/migrations/0029_publishedreview_published_date.py b/translations/migrations/0029_publishedreview_published_date.py index 78cca4a..35a0425 100644 --- a/translations/migrations/0029_publishedreview_published_date.py +++ b/translations/migrations/0029_publishedreview_published_date.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0028_auto_20201125_2018'), + ("translations", "0028_auto_20201125_2018"), ] operations = [ migrations.AddField( - model_name='publishedreview', - name='published_date', + model_name="publishedreview", + name="published_date", field=models.DateTimeField(null=True), ), ] diff --git a/translations/migrations/0030_auto_20201128_0904.py b/translations/migrations/0030_auto_20201128_0904.py index 5e4fc5e..39523f4 100644 --- a/translations/migrations/0030_auto_20201128_0904.py +++ b/translations/migrations/0030_auto_20201128_0904.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0029_publishedreview_published_date'), + ("translations", "0029_publishedreview_published_date"), ] operations = [ migrations.AlterField( - model_name='publishedreview', - name='published_date', + model_name="publishedreview", + name="published_date", field=models.DateField(null=True), ), ] diff --git a/translations/migrations/0031_auto_20201128_0906.py b/translations/migrations/0031_auto_20201128_0906.py index 0403891..63145c1 100644 --- a/translations/migrations/0031_auto_20201128_0906.py +++ b/translations/migrations/0031_auto_20201128_0906.py @@ -6,17 +6,17 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0030_auto_20201128_0904'), + ("translations", "0030_auto_20201128_0904"), ] operations = [ migrations.RemoveField( - model_name='publishedreview', - name='volume', + model_name="publishedreview", + name="volume", ), migrations.AddField( - model_name='publishedreview', - name='volume', - field=models.ManyToManyField(to='translations.Volume'), + model_name="publishedreview", + name="volume", + field=models.ManyToManyField(to="translations.Volume"), ), ] diff --git a/translations/migrations/0032_auto_20201128_0907.py b/translations/migrations/0032_auto_20201128_0907.py index 04e07b6..b9aca57 100644 --- a/translations/migrations/0032_auto_20201128_0907.py +++ b/translations/migrations/0032_auto_20201128_0907.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0031_auto_20201128_0906'), + ("translations", "0031_auto_20201128_0906"), ] operations = [ migrations.AlterField( - model_name='publishedreview', - name='published_date', + model_name="publishedreview", + name="published_date", field=models.DateField(blank=True, null=True), ), ] diff --git a/translations/migrations/0033_auto_20201128_0914.py b/translations/migrations/0033_auto_20201128_0914.py index 694c66e..08b1ddc 100644 --- a/translations/migrations/0033_auto_20201128_0914.py +++ b/translations/migrations/0033_auto_20201128_0914.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0032_auto_20201128_0907'), + ("translations", "0032_auto_20201128_0907"), ] operations = [ migrations.RenameField( - model_name='publishedreview', - old_name='volume', - new_name='volumes', + model_name="publishedreview", + old_name="volume", + new_name="volumes", ), ] diff --git a/translations/migrations/0035_auto_20201212_1833.py b/translations/migrations/0035_auto_20201212_1833.py index 74a7011..eabe772 100644 --- a/translations/migrations/0035_auto_20201212_1833.py +++ b/translations/migrations/0035_auto_20201212_1833.py @@ -6,16 +6,23 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0034_person_sort_name'), + ("translations", "0034_person_sort_name"), ] operations = [ migrations.AlterModelOptions( - name='feature', - options={'ordering': ['volume', 'source_text__author__sort_name', 'source_text', 'feature']}, + name="feature", + options={ + "ordering": [ + "volume", + "source_text__author__sort_name", + "source_text", + "feature", + ] + }, ), migrations.AlterModelOptions( - name='person', - options={'ordering': ['sort_name']}, + name="person", + options={"ordering": ["sort_name"]}, ), ] diff --git a/translations/migrations/0037_auto_20210109_2209.py b/translations/migrations/0037_auto_20210109_2209.py index db89313..9c01b08 100644 --- a/translations/migrations/0037_auto_20210109_2209.py +++ b/translations/migrations/0037_auto_20210109_2209.py @@ -1,45 +1,79 @@ # Generated by Django 3.1.4 on 2021-01-10 05:09 +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('contenttypes', '0002_remove_content_type_name'), - ('translations', '0036_auto_20201212_1841'), + ("contenttypes", "0002_remove_content_type_name"), + ("translations", "0036_auto_20201212_1841"), ] operations = [ migrations.AlterField( - model_name='feature', - name='persons', - field=models.ManyToManyField(related_name='features', to='translations.Person'), + model_name="feature", + name="persons", + field=models.ManyToManyField( + related_name="features", to="translations.Person" + ), ), migrations.AlterField( - model_name='feature', - name='volume', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='features', to='translations.volume'), + model_name="feature", + name="volume", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="features", + to="translations.volume", + ), ), migrations.CreateModel( - name='UserSubmission', + name="UserSubmission", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('processed', models.BooleanField()), - ('submission', models.TextField()), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("processed", models.BooleanField()), + ("submission", models.TextField()), + ( + "user", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), + ), ], ), migrations.CreateModel( - name='AlternateName', + name="AlternateName", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('object_id', models.PositiveIntegerField()), - ('name', models.CharField(max_length=255)), - ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("object_id", models.PositiveIntegerField()), + ("name", models.CharField(max_length=255)), + ( + "content_type", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="contenttypes.contenttype", + ), + ), ], ), ] diff --git a/translations/migrations/0038_auto_20210109_2212.py b/translations/migrations/0038_auto_20210109_2212.py index 6bc7615..e8786f7 100644 --- a/translations/migrations/0038_auto_20210109_2212.py +++ b/translations/migrations/0038_auto_20210109_2212.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0037_auto_20210109_2209'), + ("translations", "0037_auto_20210109_2209"), ] operations = [ migrations.AlterField( - model_name='usersubmission', - name='processed', + model_name="usersubmission", + name="processed", field=models.BooleanField(default=False), ), ] diff --git a/translations/migrations/0039_alternatename_alternate_name_type.py b/translations/migrations/0039_alternatename_alternate_name_type.py index 575feaf..097bf95 100644 --- a/translations/migrations/0039_alternatename_alternate_name_type.py +++ b/translations/migrations/0039_alternatename_alternate_name_type.py @@ -6,14 +6,22 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0038_auto_20210109_2212'), + ("translations", "0038_auto_20210109_2212"), ] operations = [ migrations.AddField( - model_name='alternatename', - name='alternate_name_type', - field=models.CharField(choices=[('OR', 'Original Language Name'), ('TL', 'Transliterated Original Language Name'), ('TR', 'Alternate Name Translation')], default='OR', max_length=2), + model_name="alternatename", + name="alternate_name_type", + field=models.CharField( + choices=[ + ("OR", "Original Language Name"), + ("TL", "Transliterated Original Language Name"), + ("TR", "Alternate Name Translation"), + ], + default="OR", + max_length=2, + ), preserve_default=False, ), ] diff --git a/translations/migrations/0041_auto_20210110_0950.py b/translations/migrations/0041_auto_20210110_0950.py index ed46c9b..f699d2a 100644 --- a/translations/migrations/0041_auto_20210110_0950.py +++ b/translations/migrations/0041_auto_20210110_0950.py @@ -6,17 +6,25 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0040_auto_20210109_2250'), + ("translations", "0040_auto_20210109_2250"), ] operations = [ migrations.RemoveField( - model_name='sourcetext', - name='original_language_title', + model_name="sourcetext", + name="original_language_title", ), migrations.AlterField( - model_name='alternatename', - name='alternate_name_type', - field=models.CharField(choices=[('OR', 'Original Language Name'), ('TL', 'Transliterated Original Language Name'), ('TR', 'Alternate Name Translation'), ('NM', 'Alternate Name')], max_length=2), + model_name="alternatename", + name="alternate_name_type", + field=models.CharField( + choices=[ + ("OR", "Original Language Name"), + ("TL", "Transliterated Original Language Name"), + ("TR", "Alternate Name Translation"), + ("NM", "Alternate Name"), + ], + max_length=2, + ), ), ] diff --git a/translations/migrations/0042_auto_20210130_1452.py b/translations/migrations/0042_auto_20210130_1452.py index 28c910d..46a3d8b 100644 --- a/translations/migrations/0042_auto_20210130_1452.py +++ b/translations/migrations/0042_auto_20210130_1452.py @@ -1,129 +1,175 @@ # Generated by Django 3.1.4 on 2021-01-30 21:52 -from django.conf import settings -from django.db import migrations, models import django.db.models.deletion import django.utils.timezone +from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('translations', '0041_auto_20210110_0950'), + ("translations", "0041_auto_20210110_0950"), ] operations = [ migrations.AddField( - model_name='person', - name='approved', + model_name="person", + name="approved", field=models.BooleanField(default=False), ), migrations.AddField( - model_name='person', - name='date_created', - field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + model_name="person", + name="date_created", + field=models.DateTimeField( + auto_now_add=True, default=django.utils.timezone.now + ), preserve_default=False, ), migrations.AddField( - model_name='person', - name='user', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + model_name="person", + name="user", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), ), migrations.AddField( - model_name='publishedreview', - name='approved', + model_name="publishedreview", + name="approved", field=models.BooleanField(default=False), ), migrations.AddField( - model_name='publishedreview', - name='date_created', - field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + model_name="publishedreview", + name="date_created", + field=models.DateTimeField( + auto_now_add=True, default=django.utils.timezone.now + ), preserve_default=False, ), migrations.AddField( - model_name='publishedreview', - name='user', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + model_name="publishedreview", + name="user", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), ), migrations.AddField( - model_name='publisher', - name='approved', + model_name="publisher", + name="approved", field=models.BooleanField(default=False), ), migrations.AddField( - model_name='publisher', - name='date_created', - field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + model_name="publisher", + name="date_created", + field=models.DateTimeField( + auto_now_add=True, default=django.utils.timezone.now + ), preserve_default=False, ), migrations.AddField( - model_name='publisher', - name='user', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + model_name="publisher", + name="user", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), ), migrations.AddField( - model_name='series', - name='approved', + model_name="series", + name="approved", field=models.BooleanField(default=False), ), migrations.AddField( - model_name='series', - name='date_created', - field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + model_name="series", + name="date_created", + field=models.DateTimeField( + auto_now_add=True, default=django.utils.timezone.now + ), preserve_default=False, ), migrations.AddField( - model_name='series', - name='user', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + model_name="series", + name="user", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), ), migrations.AddField( - model_name='sourcetext', - name='approved', + model_name="sourcetext", + name="approved", field=models.BooleanField(default=False), ), migrations.AddField( - model_name='sourcetext', - name='date_created', - field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + model_name="sourcetext", + name="date_created", + field=models.DateTimeField( + auto_now_add=True, default=django.utils.timezone.now + ), preserve_default=False, ), migrations.AddField( - model_name='sourcetext', - name='user', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + model_name="sourcetext", + name="user", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), ), migrations.AddField( - model_name='usersubmission', - name='date_created', - field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + model_name="usersubmission", + name="date_created", + field=models.DateTimeField( + auto_now_add=True, default=django.utils.timezone.now + ), preserve_default=False, ), migrations.AddField( - model_name='volume', - name='approved', + model_name="volume", + name="approved", field=models.BooleanField(default=False), ), migrations.AddField( - model_name='volume', - name='date_created', - field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + model_name="volume", + name="date_created", + field=models.DateTimeField( + auto_now_add=True, default=django.utils.timezone.now + ), preserve_default=False, ), migrations.AddField( - model_name='volume', - name='user', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + model_name="volume", + name="user", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='review', - name='user', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + model_name="review", + name="user", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='usersubmission', - name='user', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + model_name="usersubmission", + name="user", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/translations/migrations/0044_auto_20210219_2113.py b/translations/migrations/0044_auto_20210219_2113.py index 37146e0..1254d6a 100644 --- a/translations/migrations/0044_auto_20210219_2113.py +++ b/translations/migrations/0044_auto_20210219_2113.py @@ -1,8 +1,8 @@ # Generated by Django 3.1.4 on 2021-02-20 04:13 +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): diff --git a/translations/models.py b/translations/models.py index 5ac0eac..fa5dd43 100644 --- a/translations/models.py +++ b/translations/models.py @@ -1,10 +1,10 @@ -from django.db import models -from django.core.exceptions import ValidationError -from django.utils.translation import gettext_lazy as _ -from django.contrib.contenttypes.fields import GenericRelation, GenericForeignKey +import requests +from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType +from django.core.exceptions import ValidationError +from django.db import models from django.urls import reverse -import requests +from django.utils.translation import gettext_lazy as _ from biblia import settings diff --git a/translations/serializers.py b/translations/serializers.py index d772ca4..abc73f5 100644 --- a/translations/serializers.py +++ b/translations/serializers.py @@ -1,19 +1,20 @@ -from rest_framework import serializers from generic_relations.relations import GenericRelatedField +from rest_framework import serializers + from translations.models import ( - Person, + KIND_CHOICES, + AlternateName, + Feature, Language, - SourceText, + Link, + Person, + PublishedReview, Publisher, + Rating, + Review, Series, + SourceText, Volume, - Feature, - Review, - Rating, - PublishedReview, - Link, - AlternateName, - KIND_CHOICES, ) diff --git a/translations/urls.py b/translations/urls.py index 69c4245..a747808 100644 --- a/translations/urls.py +++ b/translations/urls.py @@ -1,5 +1,6 @@ -from django.urls import path, include +from django.urls import include, path from rest_framework.routers import DefaultRouter + from . import views router = DefaultRouter() @@ -59,7 +60,11 @@ views.PublishedReviewLWCView.as_view(), name="publishedreview_add", ), - path("volumes/add/", views.VolumeLWCView.as_view(), name="volume_add",), + path( + "volumes/add/", + views.VolumeLWCView.as_view(), + name="volume_add", + ), path( "volumes//review/", views.ReviewCreateView.as_view(), diff --git a/translations/views.py b/translations/views.py index b453b7e..bbf4857 100644 --- a/translations/views.py +++ b/translations/views.py @@ -1,51 +1,52 @@ -from django.db.models import Prefetch, Q +import rest_framework from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.postgres.search import SearchQuery, SearchRank, SearchVector -from django.http import HttpResponseRedirect, Http404 -from django.views import generic +from django.db.models import Prefetch, Q +from django.http import Http404, HttpResponseRedirect from django.urls import reverse, reverse_lazy +from django.views import generic from rest_framework import viewsets -import rest_framework from rest_framework.exceptions import MethodNotAllowed from rest_framework.permissions import DjangoModelPermissionsOrAnonReadOnly + +from users.models import User + from .models import ( - SourceText, + AlternateName, Feature, - Volume, + Language, + Link, Person, - Review, PublishedReview, Publisher, + Review, Series, - Language, + SourceText, UserSubmission, - Link, - AlternateName, + Volume, +) +from .permissions import ( + ApprovalFilteredQuerysetMixin, + CreateChildOfUnapprovedParent, + IsAuthenticatedCreateOrReadOnly, + IsOwnerEditOrReadOnly, + approval_filtered_queryset, + filter_queryset_approval, + filter_queryset_parent_approval, ) from .serializers import ( - PersonSerializer, - SourceTextSerializer, + AlternateNameSerializer, + FeatureSerializer, LanguageSerializer, + LinkSerializer, + PersonSerializer, + PublishedReviewSerializer, PublisherSerializer, + ReviewSerializer, SeriesSerializer, + SourceTextSerializer, TranslationSerializer, VolumeSerializer, - FeatureSerializer, - ReviewSerializer, - PublishedReviewSerializer, - LinkSerializer, - AlternateNameSerializer, -) - -from users.models import User -from .permissions import ( - approval_filtered_queryset, - filter_queryset_approval, - filter_queryset_parent_approval, - CreateChildOfUnapprovedParent, - IsAuthenticatedCreateOrReadOnly, - IsOwnerEditOrReadOnly, - ApprovalFilteredQuerysetMixin, ) diff --git a/users/apps.py b/users/apps.py index 4ce1fab..3ef1284 100644 --- a/users/apps.py +++ b/users/apps.py @@ -2,4 +2,4 @@ class UsersConfig(AppConfig): - name = 'users' + name = "users" diff --git a/users/forms.py b/users/forms.py index 3b0f762..79dd2d0 100644 --- a/users/forms.py +++ b/users/forms.py @@ -1,5 +1,5 @@ -from django.contrib.auth import get_user_model from django import forms +from django.contrib.auth import get_user_model class SignupForm(forms.ModelForm): diff --git a/users/migrations/0001_initial.py b/users/migrations/0001_initial.py index 8250575..20be3a6 100644 --- a/users/migrations/0001_initial.py +++ b/users/migrations/0001_initial.py @@ -2,8 +2,8 @@ import django.contrib.auth.models import django.contrib.auth.validators -from django.db import migrations, models import django.utils.timezone +from django.db import migrations, models class Migration(migrations.Migration): @@ -11,32 +11,120 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('auth', '0011_update_proxy_permissions'), + ("auth", "0011_update_proxy_permissions"), ] operations = [ migrations.CreateModel( - name='User', + name="User", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('password', models.CharField(max_length=128, verbose_name='password')), - ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), - ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), - ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), - ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')), - ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), - ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), - ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), - ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), - ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), - ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), - ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("password", models.CharField(max_length=128, verbose_name="password")), + ( + "last_login", + models.DateTimeField( + blank=True, null=True, verbose_name="last login" + ), + ), + ( + "is_superuser", + models.BooleanField( + default=False, + help_text="Designates that this user has all permissions without explicitly assigning them.", + verbose_name="superuser status", + ), + ), + ( + "username", + models.CharField( + error_messages={ + "unique": "A user with that username already exists." + }, + help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.", + max_length=150, + unique=True, + validators=[ + django.contrib.auth.validators.UnicodeUsernameValidator() + ], + verbose_name="username", + ), + ), + ( + "first_name", + models.CharField( + blank=True, max_length=30, verbose_name="first name" + ), + ), + ( + "last_name", + models.CharField( + blank=True, max_length=150, verbose_name="last name" + ), + ), + ( + "email", + models.EmailField( + blank=True, max_length=254, verbose_name="email address" + ), + ), + ( + "is_staff", + models.BooleanField( + default=False, + help_text="Designates whether the user can log into this admin site.", + verbose_name="staff status", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.", + verbose_name="active", + ), + ), + ( + "date_joined", + models.DateTimeField( + default=django.utils.timezone.now, verbose_name="date joined" + ), + ), + ( + "groups", + models.ManyToManyField( + blank=True, + help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.", + related_name="user_set", + related_query_name="user", + to="auth.Group", + verbose_name="groups", + ), + ), + ( + "user_permissions", + models.ManyToManyField( + blank=True, + help_text="Specific permissions for this user.", + related_name="user_set", + related_query_name="user", + to="auth.Permission", + verbose_name="user permissions", + ), + ), ], options={ - 'db_table': 'auth_user', + "db_table": "auth_user", }, managers=[ - ('objects', django.contrib.auth.models.UserManager()), + ("objects", django.contrib.auth.models.UserManager()), ], ), ] diff --git a/users/migrations/0002_auto_20201122_1748.py b/users/migrations/0002_auto_20201122_1748.py index 84767c2..eef7573 100644 --- a/users/migrations/0002_auto_20201122_1748.py +++ b/users/migrations/0002_auto_20201122_1748.py @@ -6,16 +6,16 @@ class Migration(migrations.Migration): dependencies = [ - ('users', '0001_initial'), + ("users", "0001_initial"), ] operations = [ migrations.AlterModelOptions( - name='user', - options={'verbose_name': 'user', 'verbose_name_plural': 'users'}, + name="user", + options={"verbose_name": "user", "verbose_name_plural": "users"}, ), migrations.AlterModelTable( - name='user', + name="user", table=None, ), ] diff --git a/users/migrations/0003_auto_20201122_2215.py b/users/migrations/0003_auto_20201122_2215.py index 15734ce..01ba8ff 100644 --- a/users/migrations/0003_auto_20201122_2215.py +++ b/users/migrations/0003_auto_20201122_2215.py @@ -6,19 +6,19 @@ class Migration(migrations.Migration): dependencies = [ - ('users', '0002_auto_20201122_1748'), + ("users", "0002_auto_20201122_1748"), ] operations = [ migrations.AddField( - model_name='user', - name='display_name', - field=models.CharField(default='Anonymous', max_length=255), + model_name="user", + name="display_name", + field=models.CharField(default="Anonymous", max_length=255), preserve_default=False, ), migrations.AddField( - model_name='user', - name='profile', + model_name="user", + name="profile", field=models.TextField(blank=True, null=True), ), ] diff --git a/users/migrations/0004_auto_20210109_2209.py b/users/migrations/0004_auto_20210109_2209.py index 5f2d84f..326a3b1 100644 --- a/users/migrations/0004_auto_20210109_2209.py +++ b/users/migrations/0004_auto_20210109_2209.py @@ -6,13 +6,15 @@ class Migration(migrations.Migration): dependencies = [ - ('users', '0003_auto_20201122_2215'), + ("users", "0003_auto_20201122_2215"), ] operations = [ migrations.AlterField( - model_name='user', - name='first_name', - field=models.CharField(blank=True, max_length=150, verbose_name='first name'), + model_name="user", + name="first_name", + field=models.CharField( + blank=True, max_length=150, verbose_name="first name" + ), ), ] diff --git a/users/tests.py b/users/tests.py index 7ce503c..a79ca8b 100644 --- a/users/tests.py +++ b/users/tests.py @@ -1,3 +1,3 @@ -from django.test import TestCase +# from django.test import TestCase # Create your tests here. diff --git a/users/urls.py b/users/urls.py index ce6fecd..7863b07 100644 --- a/users/urls.py +++ b/users/urls.py @@ -1,4 +1,4 @@ -from django.urls import path, include +from django.urls import include, path from rest_framework.routers import DefaultRouter from . import views @@ -8,5 +8,9 @@ urlpatterns = [ path("api/", include(router.urls)), - path("user/profile/update/", views.UserUpdateView.as_view(), name="user_update",), + path( + "user/profile/update/", + views.UserUpdateView.as_view(), + name="user_update", + ), ] diff --git a/users/views.py b/users/views.py index ae61f7e..2a91e86 100644 --- a/users/views.py +++ b/users/views.py @@ -1,6 +1,6 @@ from django.contrib.auth.mixins import LoginRequiredMixin -from django.views import generic from django.urls import reverse_lazy +from django.views import generic from rest_framework import viewsets from .models import User From 2009c9a58f3d5d8207ff2d0931fdb17515a42db2 Mon Sep 17 00:00:00 2001 From: David Reed Date: Mon, 8 Mar 2021 19:53:39 -0700 Subject: [PATCH 2/2] Avoid formatting files that don't play nicely with Prettier --- .prettierignore | 5 +- .prettierrc | 2 +- package.json | 11 +- pyproject.toml | 7 + src/modules/bib/dataTable/dataTable.html | 32 +++- .../bib/translationView/translationView.html | 156 ++++++++++++++---- 6 files changed, 164 insertions(+), 49 deletions(-) create mode 100644 pyproject.toml diff --git a/.prettierignore b/.prettierignore index b03e4e1..af9bbc5 100644 --- a/.prettierignore +++ b/.prettierignore @@ -13,4 +13,7 @@ src/resources venv node_modules translations/static -package-lock.json \ No newline at end of file +package-lock.json +.pytest_cache +.vscode +commaLinkList.html \ No newline at end of file diff --git a/.prettierrc b/.prettierrc index 4d96f64..0613395 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,7 +4,7 @@ "tabWidth": 4, "overrides": [ { - "files": "**/*.html", + "files": "src/**/*.html", "options": { "parser": "lwc" } } ] diff --git a/package.json b/package.json index b042376..5ce1afc 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,11 @@ ], "license": "MIT", "lint-staged": { - "**/*.{css,html,js,json,md,ts,yaml,yml}": [ - "npm run prettier:verify" + "**/*.{css,js,json,md,ts,yaml,yml}": [ + "prettier --write" + ], + "src/**/*.html": [ + "prettier --write" ], "./src/**/*.js": [ "eslint" @@ -48,8 +51,8 @@ "build": "lwc-services build -m production -w webpack.config.js", "build:development": "lwc-services build -w webpack.config.js", "lint": "eslint ./src/**/*.js", - "prettier": "prettier --write \"**/*.{css,js,json,md,ts,yaml,yml}\"", - "prettier:verify": "prettier --list-different \"**/*.{css,js,json,md,ts,yaml,yml}\"", + "prettier": "prettier --write \"**/*.{css,js,json,md,ts,yaml,yml}\" \"src/**/*.html\"", + "prettier:verify": "prettier --list-different \"**/*.{css,js,json,md,ts,yaml,yml}\" \"src/**/*.html\"", "test:unit": "lwc-services test:unit", "test:unit:coverage": "lwc-services test:unit --coverage", "test:unit:debug": "lwc-services test:unit --debug", diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..929503c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,7 @@ +[tool.isort] +profile = "black" +multi_line_output = 3 + +[tool.black] +line-length = 88 +target-version = ['py38'] diff --git a/src/modules/bib/dataTable/dataTable.html b/src/modules/bib/dataTable/dataTable.html index 99c051f..bf6dbca 100644 --- a/src/modules/bib/dataTable/dataTable.html +++ b/src/modules/bib/dataTable/dataTable.html @@ -6,9 +6,16 @@ \ No newline at end of file + diff --git a/src/modules/bib/translationView/translationView.html b/src/modules/bib/translationView/translationView.html index 3f9171b..64e1481 100644 --- a/src/modules/bib/translationView/translationView.html +++ b/src/modules/bib/translationView/translationView.html @@ -1,11 +1,20 @@ \ No newline at end of file +