mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2024-11-27 12:53:03 +00:00
Linting
This commit is contained in:
parent
c424c7c040
commit
d75250f436
@ -1,10 +1,9 @@
|
|||||||
from django.core.management import BaseCommand
|
from django.core.management import BaseCommand
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from tqdm import tqdm
|
|
||||||
|
|
||||||
from media.models import CD, Comic, Game, Manga, Novel, Review, Vinyl, \
|
from media.models import CD, Comic, Game, Manga, Novel, Review, Vinyl, \
|
||||||
OldCD, OldComic, OldGame, OldManga, OldNovel, OldReview, OldVinyl
|
OldCD, OldComic, OldGame, OldManga, OldNovel, OldReview, OldVinyl
|
||||||
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
@ -17,7 +16,7 @@ class Command(BaseCommand):
|
|||||||
help="Actually do the mogration.")
|
help="Actually do the mogration.")
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options): # noqa: C901
|
||||||
# Migrate books
|
# Migrate books
|
||||||
for old_book_class, book_class in [(OldComic, Comic),
|
for old_book_class, book_class in [(OldComic, Comic),
|
||||||
(OldManga, Manga),
|
(OldManga, Manga),
|
||||||
@ -39,7 +38,7 @@ class Command(BaseCommand):
|
|||||||
)
|
)
|
||||||
new_book.authors.set(book.authors.all())
|
new_book.authors.set(book.authors.all())
|
||||||
new_book.save()
|
new_book.save()
|
||||||
except:
|
except Exception:
|
||||||
self.stderr.write(f"There was an error with {name} "
|
self.stderr.write(f"There was an error with {name} "
|
||||||
f"{book} ({book.pk})")
|
f"{book} ({book.pk})")
|
||||||
raise
|
raise
|
||||||
@ -57,7 +56,7 @@ class Command(BaseCommand):
|
|||||||
)
|
)
|
||||||
new_cd.authors.set(cd.authors.all())
|
new_cd.authors.set(cd.authors.all())
|
||||||
new_cd.save()
|
new_cd.save()
|
||||||
except:
|
except Exception:
|
||||||
self.stderr.write(f"There was an error with {cd} ({cd.pk})")
|
self.stderr.write(f"There was an error with {cd} ({cd.pk})")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -74,7 +73,7 @@ class Command(BaseCommand):
|
|||||||
)
|
)
|
||||||
new_vinyl.authors.set(vinyl.authors.all())
|
new_vinyl.authors.set(vinyl.authors.all())
|
||||||
new_vinyl.save()
|
new_vinyl.save()
|
||||||
except:
|
except Exception:
|
||||||
self.stderr.write(f"There was an error with {vinyl} "
|
self.stderr.write(f"There was an error with {vinyl} "
|
||||||
f"({vinyl.pk})")
|
f"({vinyl.pk})")
|
||||||
raise
|
raise
|
||||||
@ -94,7 +93,7 @@ class Command(BaseCommand):
|
|||||||
double=review.double,
|
double=review.double,
|
||||||
present=review.present,
|
present=review.present,
|
||||||
)
|
)
|
||||||
except:
|
except Exception:
|
||||||
self.stderr.write(f"There was an error with {review} "
|
self.stderr.write(f"There was an error with {review} "
|
||||||
f"({review.pk})")
|
f"({review.pk})")
|
||||||
raise
|
raise
|
||||||
@ -113,7 +112,7 @@ class Command(BaseCommand):
|
|||||||
players_max=game.players_max,
|
players_max=game.players_max,
|
||||||
comment=game.comment,
|
comment=game.comment,
|
||||||
)
|
)
|
||||||
except:
|
except Exception:
|
||||||
self.stderr.write(f"There was an error with {game} "
|
self.stderr.write(f"There was an error with {game} "
|
||||||
f"({game.pk})")
|
f"({game.pk})")
|
||||||
raise
|
raise
|
||||||
|
Loading…
Reference in New Issue
Block a user