1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2025-06-29 18:31:09 +02:00

Add shortcut and order

This commit is contained in:
Alexandre Iooss
2019-08-11 18:37:04 +02:00
parent d08ac181c9
commit 7d94609f9b
4 changed files with 138 additions and 1 deletions

View File

@ -20,6 +20,7 @@ class MediaAdminForm(ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['isbn'].widget.template_name = "media/isbn_button.html"
self.fields['isbn'].widget.attrs.update({'autofocus': 'autofocus'})
def download_data(self, isbn):
"""

View File

@ -0,0 +1,29 @@
# Generated by Django 2.2.4 on 2019-08-11 16:04
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('media', '0021_auto_20190811_1047'),
]
operations = [
migrations.AlterModelOptions(
name='auteur',
options={'ordering': ['nom'], 'verbose_name': 'author', 'verbose_name_plural': 'authors'},
),
migrations.AlterModelOptions(
name='emprunt',
options={'ordering': ['-date_emprunt'], 'verbose_name': 'borrowed item', 'verbose_name_plural': 'borrowed items'},
),
migrations.AlterModelOptions(
name='jeu',
options={'ordering': ['nom'], 'verbose_name': 'game', 'verbose_name_plural': 'games'},
),
migrations.AlterModelOptions(
name='media',
options={'ordering': ['title', 'subtitle'], 'verbose_name': 'medium', 'verbose_name_plural': 'media'},
),
]

View File

@ -18,6 +18,7 @@ class Auteur(models.Model):
class Meta:
verbose_name = _("author")
verbose_name_plural = _("authors")
ordering = ['nom']
class Media(models.Model):
@ -62,11 +63,13 @@ class Media(models.Model):
)
def __str__(self):
return str(self.title) + ' - ' + str(self.authors.all().first())
return str(self.title) + ' - ' + str(self.subtitle) \
+ ' - ' + str(self.authors.all().first())
class Meta:
verbose_name = _("medium")
verbose_name_plural = _("media")
ordering = ['title', 'subtitle']
class Emprunt(models.Model):
@ -97,6 +100,7 @@ class Emprunt(models.Model):
class Meta:
verbose_name = _("borrowed item")
verbose_name_plural = _("borrowed items")
ordering = ['-date_emprunt']
class Jeu(models.Model):
@ -122,3 +126,4 @@ class Jeu(models.Model):
class Meta:
verbose_name = _("game")
verbose_name_plural = _("games")
ordering = ['nom']