run lint on 3.12
This commit is contained in:
parent
eff338f356
commit
5d88282f4e
5 changed files with 229 additions and 237 deletions
|
@ -1,23 +0,0 @@
|
||||||
class SoftDeleteMixin:
|
|
||||||
"""
|
|
||||||
SoftDeleteMixin
|
|
||||||
|
|
||||||
Model must add this:
|
|
||||||
is_deleted = models.BooleanField(default=False, db_index=True)
|
|
||||||
|
|
||||||
Model may override this:
|
|
||||||
def clear(self):
|
|
||||||
pass
|
|
||||||
"""
|
|
||||||
|
|
||||||
def clear(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def delete(self, using=None, keep_parents=False, soft=True, *args, **kwargs):
|
|
||||||
if soft:
|
|
||||||
self.clear()
|
|
||||||
self.is_deleted = True
|
|
||||||
self.save(using=using) # type: ignore
|
|
||||||
return 0, {}
|
|
||||||
else:
|
|
||||||
return super().delete(using=using, keep_parents=keep_parents, *args, **kwargs) # type: ignore
|
|
|
@ -6,7 +6,6 @@ import django.db.models.deletion
|
||||||
import simple_history.models
|
import simple_history.models
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
import catalog.common.mixins
|
|
||||||
import catalog.common.utils
|
import catalog.common.utils
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,7 +212,7 @@ class Migration(migrations.Migration):
|
||||||
("edited_time", models.DateTimeField(auto_now=True)),
|
("edited_time", models.DateTimeField(auto_now=True)),
|
||||||
("is_deleted", models.BooleanField(db_index=True, default=False)),
|
("is_deleted", models.BooleanField(db_index=True, default=False)),
|
||||||
],
|
],
|
||||||
bases=(catalog.common.mixins.SoftDeleteMixin, models.Model),
|
bases=(models.Model,),
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name="Album",
|
name="Album",
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from auditlog.registry import auditlog
|
from auditlog.registry import auditlog
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.contenttypes.models import ContentType
|
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from .book.models import Edition, EditionInSchema, EditionSchema, Series, Work
|
from .book.models import Edition, EditionInSchema, EditionSchema, Series, Work
|
||||||
|
@ -101,11 +100,6 @@ def init_catalog_audit_log():
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Edition",
|
|
||||||
"EditionInSchema",
|
|
||||||
"EditionSchema",
|
|
||||||
"Series",
|
|
||||||
"Work",
|
|
||||||
"CatalogCollection",
|
"CatalogCollection",
|
||||||
"AvailableItemCategory",
|
"AvailableItemCategory",
|
||||||
"ExternalResource",
|
"ExternalResource",
|
||||||
|
@ -118,6 +112,11 @@ __all__ = [
|
||||||
"SiteName",
|
"SiteName",
|
||||||
"item_categories",
|
"item_categories",
|
||||||
"item_content_types",
|
"item_content_types",
|
||||||
|
"Edition",
|
||||||
|
"EditionInSchema",
|
||||||
|
"EditionSchema",
|
||||||
|
"Series",
|
||||||
|
"Work",
|
||||||
"Game",
|
"Game",
|
||||||
"GameInSchema",
|
"GameInSchema",
|
||||||
"GameSchema",
|
"GameSchema",
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,17 +1,6 @@
|
||||||
[tool.pyright]
|
[tool.pyright]
|
||||||
exclude = [ "media", ".venv", ".git", "playground", "catalog/*/tests.py", "journal/tests.py", "neodb", "**/migrations", "**/sites/douban_*", "neodb-takahe" ]
|
exclude = [ "media", ".venv", ".git", "playground", "catalog/*/tests.py", "journal/tests.py", "neodb", "**/migrations", "**/sites/douban_*", "neodb-takahe" ]
|
||||||
reportIncompatibleVariableOverride = false
|
reportIncompatibleVariableOverride = false
|
||||||
reportUnusedImport = false
|
|
||||||
reportUnknownVariableType = false
|
|
||||||
reportConstantRedefinition = false
|
|
||||||
reportUnusedCallResult = false
|
|
||||||
reportUnknownMemberType = false
|
|
||||||
reportUnknownArgumentType = false
|
|
||||||
reportAny = false
|
|
||||||
reportImplicitOverride = false
|
|
||||||
reportUninitializedInstanceVariable = false
|
|
||||||
reportMissingTypeStubs = false
|
|
||||||
reportIgnoreCommentWithoutRule = false
|
|
||||||
|
|
||||||
[tool.djlint]
|
[tool.djlint]
|
||||||
ignore="T002,T003,H005,H006,H019,H020,H021,H023,H030,H031,D018"
|
ignore="T002,T003,H005,H006,H019,H020,H021,H023,H030,H031,D018"
|
||||||
|
|
Loading…
Add table
Reference in a new issue