mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2024-12-25 06:22:23 +00:00
Translate game fields into english
This commit is contained in:
parent
7396cfc017
commit
9f5807e3b5
@ -13,12 +13,12 @@ from .models import Author, CD, Comic, Emprunt, FutureMedium, Game, Manga,\
|
||||
Novel, Review, Vinyl
|
||||
|
||||
|
||||
class AuteurAdmin(VersionAdmin):
|
||||
class AuthorAdmin(VersionAdmin):
|
||||
list_display = ('name',)
|
||||
search_fields = ('name',)
|
||||
|
||||
|
||||
class MediaAdmin(VersionAdmin):
|
||||
class MediumAdmin(VersionAdmin):
|
||||
list_display = ('__str__', 'authors_list', 'side_identifier', 'isbn',
|
||||
'external_link')
|
||||
search_fields = ('title', 'authors__name', 'side_identifier', 'subtitle',
|
||||
@ -61,7 +61,7 @@ class MediaAdmin(VersionAdmin):
|
||||
extra_context=extra_context)
|
||||
|
||||
|
||||
class FutureMediaAdmin(VersionAdmin):
|
||||
class FutureMediumAdmin(VersionAdmin):
|
||||
list_display = ('isbn',)
|
||||
search_fields = ('isbn',)
|
||||
|
||||
@ -88,7 +88,7 @@ class CDAdmin(VersionAdmin):
|
||||
authors_list.short_description = _('authors')
|
||||
|
||||
|
||||
class VinyleAdmin(VersionAdmin):
|
||||
class VinylAdmin(VersionAdmin):
|
||||
list_display = ('title', 'authors_list', 'side_identifier', 'rpm',)
|
||||
search_fields = ('title', 'authors__name', 'side_identifier', 'rpm',)
|
||||
autocomplete_fields = ('authors',)
|
||||
@ -99,7 +99,7 @@ class VinyleAdmin(VersionAdmin):
|
||||
authors_list.short_description = _('authors')
|
||||
|
||||
|
||||
class RevueAdmin(VersionAdmin):
|
||||
class ReviewAdmin(VersionAdmin):
|
||||
list_display = ('__str__', 'number', 'year', 'month', 'day', 'double',)
|
||||
search_fields = ('title', 'number', 'year',)
|
||||
|
||||
@ -140,20 +140,20 @@ class EmpruntAdmin(VersionAdmin):
|
||||
return super().add_view(request, form_url, extra_context)
|
||||
|
||||
|
||||
class JeuAdmin(VersionAdmin):
|
||||
list_display = ('name', 'proprietaire', 'duree', 'nombre_joueurs_min',
|
||||
'nombre_joueurs_max', 'comment')
|
||||
search_fields = ('name', 'proprietaire__username', 'duree', 'comment')
|
||||
autocomplete_fields = ('proprietaire',)
|
||||
class GameAdmin(VersionAdmin):
|
||||
list_display = ('name', 'owner', 'duration', 'players_min',
|
||||
'players_max', 'comment')
|
||||
search_fields = ('name', 'owner__username', 'duration', 'comment')
|
||||
autocomplete_fields = ('owner',)
|
||||
|
||||
|
||||
admin_site.register(Author, AuteurAdmin)
|
||||
admin_site.register(Comic, MediaAdmin)
|
||||
admin_site.register(Manga, MediaAdmin)
|
||||
admin_site.register(Novel, MediaAdmin)
|
||||
admin_site.register(Author, AuthorAdmin)
|
||||
admin_site.register(Comic, MediumAdmin)
|
||||
admin_site.register(Manga, MediumAdmin)
|
||||
admin_site.register(Novel, MediumAdmin)
|
||||
admin_site.register(CD, CDAdmin)
|
||||
admin_site.register(Vinyl, VinyleAdmin)
|
||||
admin_site.register(Review, RevueAdmin)
|
||||
admin_site.register(FutureMedium, FutureMediaAdmin)
|
||||
admin_site.register(Vinyl, VinylAdmin)
|
||||
admin_site.register(Review, ReviewAdmin)
|
||||
admin_site.register(FutureMedium, FutureMediumAdmin)
|
||||
admin_site.register(Emprunt, EmpruntAdmin)
|
||||
admin_site.register(Game, JeuAdmin)
|
||||
admin_site.register(Game, GameAdmin)
|
||||
|
@ -53,11 +53,11 @@ class Command(BaseCommand):
|
||||
|
||||
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} "
|
||||
f"- {game.nombre_joueurs_max}\n\n")
|
||||
if game.proprietaire.username != "Med":
|
||||
f.write(f"Propriétaire : {game.proprietaire.username}\n\n")
|
||||
f.write(f"Durée : {game.duration}\n\n")
|
||||
f.write(f"Nombre de joueurs : {game.players_min} "
|
||||
f"- {game.players_max}\n\n")
|
||||
if game.owner.username != "Med":
|
||||
f.write(f"Propriétaire : {game.owner.username}\n\n")
|
||||
if game.comment:
|
||||
f.write(f"Commentaire : {game.comment}\n\n")
|
||||
f.write("\n\n\n")
|
||||
|
44
media/migrations/0041_auto_20211023_1838.py
Normal file
44
media/migrations/0041_auto_20211023_1838.py
Normal file
@ -0,0 +1,44 @@
|
||||
# Generated by Django 2.2.17 on 2021-10-23 16:38
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('media', '0040_auto_20211023_1830'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='game',
|
||||
old_name='duree',
|
||||
new_name='duration',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='game',
|
||||
old_name='proprietaire',
|
||||
new_name='owner',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='game',
|
||||
old_name='nombre_joueurs_max',
|
||||
new_name='players_max',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='game',
|
||||
old_name='nombre_joueurs_min',
|
||||
new_name='players_min',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='emprunt',
|
||||
name='media',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='media.Comic'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='futuremedium',
|
||||
name='type',
|
||||
field=models.CharField(choices=[('bd', 'Comic'), ('manga', 'Manga'), ('roman', 'Roman')], max_length=8, verbose_name='type'),
|
||||
),
|
||||
]
|
@ -418,7 +418,7 @@ class Emprunt(models.Model):
|
||||
|
||||
|
||||
class Game(models.Model):
|
||||
DUREE = (
|
||||
DURATIONS = (
|
||||
('-1h', '-1h'),
|
||||
('1-2h', '1-2h'),
|
||||
('2-3h', '2-3h'),
|
||||
@ -430,21 +430,21 @@ class Game(models.Model):
|
||||
max_length=255,
|
||||
verbose_name=_("name"),
|
||||
)
|
||||
proprietaire = models.ForeignKey(
|
||||
owner = models.ForeignKey(
|
||||
'users.User',
|
||||
on_delete=models.PROTECT,
|
||||
verbose_name=_("owner"),
|
||||
)
|
||||
duree = models.CharField(
|
||||
choices=DUREE,
|
||||
duration = models.CharField(
|
||||
choices=DURATIONS,
|
||||
max_length=255,
|
||||
verbose_name=_("duration"),
|
||||
)
|
||||
nombre_joueurs_min = models.IntegerField(
|
||||
players_min = models.IntegerField(
|
||||
validators=[MinValueValidator(1)],
|
||||
verbose_name=_("minimum number of players"),
|
||||
)
|
||||
nombre_joueurs_max = models.IntegerField(
|
||||
players_max = models.IntegerField(
|
||||
validators=[MinValueValidator(1)],
|
||||
verbose_name=_('maximum number of players'),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user