mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2025-06-29 21:11:08 +02:00
Translate models in english
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from django.core.management import BaseCommand
|
||||
from media.models import BD, CD, Manga, Revue, Roman, Vinyle, Jeu
|
||||
from media.models import Comic, CD, Manga, Review, Novel, Vinyl, Game
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@ -18,9 +18,9 @@ class Command(BaseCommand):
|
||||
f.write("Ce site répertorie l'intégralité des media présents "
|
||||
"à la Mediatek de l'ENS Paris-Saclay.\n")
|
||||
|
||||
for model_class, file_name in [(BD, "bd.md"), (Manga, "mangas.md"),
|
||||
(Roman, "romans.md"),
|
||||
(CD, "cd.md"), (Vinyle, "vinyles.md")]:
|
||||
for model_class, file_name in [(Comic, "bd.md"), (Manga, "mangas.md"),
|
||||
(Novel, "romans.md"),
|
||||
(CD, "cd.md"), (Vinyl, "vinyles.md")]:
|
||||
self.process_model_class(model_class, file_name, f, directory)
|
||||
|
||||
# Traitement différent pour les revues
|
||||
@ -28,13 +28,13 @@ class Command(BaseCommand):
|
||||
f.write("# Revues\n\n\n")
|
||||
|
||||
titles = list(set(obj["title"] for obj in
|
||||
Revue.objects.values("title").distinct().all()))
|
||||
Review.objects.values("title").distinct().all()))
|
||||
titles.sort()
|
||||
|
||||
for title in titles:
|
||||
f.write(f"## {title}\n\n\n")
|
||||
|
||||
for medium in Revue.objects.filter(title=title)\
|
||||
for medium in Review.objects.filter(title=title)\
|
||||
.order_by("number").all():
|
||||
f.write(f"### Numéro {medium.number}\n\n\n")
|
||||
if medium.double:
|
||||
@ -51,7 +51,7 @@ class Command(BaseCommand):
|
||||
with open(directory + "/docs/jeux.md", "w") as f:
|
||||
f.write("# Jeux\n\n\n")
|
||||
|
||||
for game in Jeu.objects.order_by("name").all():
|
||||
for game in Game.objects.order_by("name").all():
|
||||
f.write(f"## {game.name}\n\n\n")
|
||||
f.write(f"Durée : {game.duree}\n\n")
|
||||
f.write(f"Nombre de joueurs : {game.nombre_joueurs_min} "
|
||||
|
@ -2,7 +2,7 @@ from argparse import FileType
|
||||
from sys import stdin
|
||||
|
||||
from django.core.management import BaseCommand
|
||||
from media.models import Auteur, CD
|
||||
from media.models import Author, CD
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@ -29,7 +29,7 @@ class Command(BaseCommand):
|
||||
title = cd[0]
|
||||
side = cd[1]
|
||||
authors_str = cd[2].split('|')
|
||||
authors = [Auteur.objects.get_or_create(name=author)[0]
|
||||
authors = [Author.objects.get_or_create(name=author)[0]
|
||||
for author in authors_str]
|
||||
cd, created = CD.objects.get_or_create(
|
||||
title=title,
|
||||
|
@ -3,20 +3,20 @@ from time import sleep
|
||||
|
||||
from django.core.management import BaseCommand
|
||||
from media.forms import MediaAdminForm
|
||||
from media.models import BD, FutureMedia, Manga, Roman
|
||||
from media.models import Comic, FutureMedium, Manga, Novel
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
for future_medium in FutureMedia.objects.all():
|
||||
for future_medium in FutureMedium.objects.all():
|
||||
isbn = future_medium.isbn
|
||||
type_str = future_medium.type
|
||||
if type_str == 'bd':
|
||||
cl = BD
|
||||
cl = Comic
|
||||
elif type_str == 'manga':
|
||||
cl = Manga
|
||||
elif type_str == 'roman':
|
||||
cl = Roman
|
||||
cl = Novel
|
||||
else:
|
||||
self.stderr.write(self.style.WARNING(
|
||||
"Unknown medium type: {type}. Ignoring..."
|
||||
|
@ -3,7 +3,7 @@ from sys import stdin
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.management import BaseCommand
|
||||
from media.models import BD, FutureMedia, Manga, Roman
|
||||
from media.models import Comic, FutureMedium, Manga, Novel
|
||||
from media.validators import isbn_validator
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
type_str = options["media_type"]
|
||||
|
||||
media_classes = [BD, Manga, Roman, FutureMedia]
|
||||
media_classes = [Comic, Manga, Novel, FutureMedium]
|
||||
|
||||
file = options["input"]
|
||||
isbns = []
|
||||
@ -70,7 +70,7 @@ class Command(BaseCommand):
|
||||
if isbn_exists:
|
||||
continue
|
||||
|
||||
FutureMedia.objects.create(isbn=isbn, type=type_str)
|
||||
FutureMedium.objects.create(isbn=isbn, type=type_str)
|
||||
self.stdout.write(self.style.SUCCESS("ISBN {isbn} imported"
|
||||
.format(isbn=isbn)))
|
||||
imported += 1
|
||||
|
@ -2,7 +2,7 @@ from argparse import FileType
|
||||
from sys import stdin
|
||||
|
||||
from django.core.management import BaseCommand
|
||||
from media.models import Auteur, BD
|
||||
from media.models import Author, Comic
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@ -28,9 +28,9 @@ class Command(BaseCommand):
|
||||
|
||||
title = revue[0]
|
||||
number = revue[1]
|
||||
authors = [Auteur.objects.get_or_create(name=n)[0]
|
||||
authors = [Author.objects.get_or_create(name=n)[0]
|
||||
for n in revue[2].split('|')]
|
||||
bd = BD.objects.create(
|
||||
bd = Comic.objects.create(
|
||||
title=title,
|
||||
subtitle=number,
|
||||
side_identifier="{:.3} {:.3} {:0>2}"
|
||||
|
@ -3,7 +3,7 @@ from sys import stdin
|
||||
|
||||
from django.core.management import BaseCommand
|
||||
from media.forms import generate_side_identifier
|
||||
from media.models import Roman, Auteur
|
||||
from media.models import Novel, Author
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@ -28,10 +28,10 @@ class Command(BaseCommand):
|
||||
continue
|
||||
|
||||
title = book[1]
|
||||
authors = [Auteur.objects.get_or_create(name=n)[0]
|
||||
authors = [Author.objects.get_or_create(name=n)[0]
|
||||
for n in book[0].split(';')]
|
||||
side_identifier = generate_side_identifier(title, authors)
|
||||
roman = Roman.objects.create(
|
||||
roman = Novel.objects.create(
|
||||
title=title,
|
||||
side_identifier=side_identifier,
|
||||
)
|
||||
|
@ -2,7 +2,7 @@ from argparse import FileType
|
||||
from sys import stdin
|
||||
|
||||
from django.core.management import BaseCommand
|
||||
from media.models import Revue
|
||||
from media.models import Review
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@ -37,7 +37,7 @@ class Command(BaseCommand):
|
||||
year = revue[4]
|
||||
if not year:
|
||||
year = None
|
||||
revue, created = Revue.objects.get_or_create(
|
||||
revue, created = Review.objects.get_or_create(
|
||||
title=title,
|
||||
number=number.replace('*', ''),
|
||||
year=year,
|
||||
|
@ -2,7 +2,7 @@ from argparse import FileType
|
||||
from sys import stdin
|
||||
|
||||
from django.core.management import BaseCommand
|
||||
from media.models import Auteur, Vinyle
|
||||
from media.models import Author, Vinyl
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@ -36,9 +36,9 @@ class Command(BaseCommand):
|
||||
title = vinyle[1 if rpm == 33 else 2]
|
||||
authors_str = vinyle[2 if rpm == 33 else 1]\
|
||||
.split('|' if rpm == 33 else ';')
|
||||
authors = [Auteur.objects.get_or_create(name=author)[0]
|
||||
authors = [Author.objects.get_or_create(name=author)[0]
|
||||
for author in authors_str]
|
||||
vinyle, created = Vinyle.objects.get_or_create(
|
||||
vinyle, created = Vinyl.objects.get_or_create(
|
||||
title=title,
|
||||
side_identifier=side,
|
||||
rpm=rpm,
|
||||
|
@ -1,7 +1,7 @@
|
||||
from django.core.management import BaseCommand
|
||||
from django.db import transaction
|
||||
from media.forms import generate_side_identifier
|
||||
from media.models import BD, Manga, Roman
|
||||
from media.models import Comic, Manga, Novel
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@ -24,11 +24,11 @@ class Command(BaseCommand):
|
||||
t = options["type"]
|
||||
medium_class = None
|
||||
if t == "bd":
|
||||
medium_class = BD
|
||||
medium_class = Comic
|
||||
elif t == "manga":
|
||||
medium_class = Manga
|
||||
elif t == "roman":
|
||||
medium_class = Roman
|
||||
medium_class = Novel
|
||||
|
||||
interactive_mode = not options["noninteractivemode"]
|
||||
|
||||
|
@ -2,7 +2,7 @@ from time import sleep
|
||||
|
||||
from django.core.management import BaseCommand
|
||||
from media.forms import MediaAdminForm
|
||||
from media.models import BD, Manga
|
||||
from media.models import Comic, Manga
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@ -14,7 +14,7 @@ class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
converted = 0
|
||||
|
||||
for media in BD.objects.all():
|
||||
for media in Comic.objects.all():
|
||||
if media.pk < 3400:
|
||||
continue
|
||||
# We sleep 5 seconds to avoid a ban from Bedetheque
|
||||
|
Reference in New Issue
Block a user