1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2025-07-06 07:23:56 +02:00

Adapt media to ISBN

This commit is contained in:
Alexandre Iooss
2019-08-11 09:22:22 +02:00
parent 79ad58997a
commit 2f872eccce
20 changed files with 397 additions and 11 deletions

View File

@ -6,6 +6,8 @@ from django.core.validators import MinValueValidator
from django.db import models
from django.utils.translation import gettext_lazy as _
from .fields import ISBNField
class Auteur(models.Model):
nom = models.CharField(max_length=255, unique=True)
@ -19,12 +21,48 @@ class Auteur(models.Model):
class Media(models.Model):
titre = models.CharField(max_length=255)
cote = models.CharField(max_length=31)
auteur = models.ManyToManyField('Auteur')
isbn = ISBNField(
_('ISBN'),
help_text=_('You may be able to scan it from a bar code.'),
blank=True,
null=True,
)
title = models.CharField(
verbose_name=_('title'),
max_length=255,
)
subtitle = models.CharField(
verbose_name=_('subtitle'),
max_length=255,
blank=True,
null=True,
)
external_url = models.URLField(
verbose_name=_('external URL'),
blank=True,
null=True,
)
side_title = models.CharField(
verbose_name=_('side title'),
max_length=255,
)
authors = models.ManyToManyField(
'Auteur',
verbose_name=_('authors'),
)
number_of_pages = models.PositiveIntegerField(
verbose_name=_('number of pages'),
blank=True,
null=True,
)
publish_date = models.DateField(
verbose_name=_('publish date'),
blank=True,
null=True,
)
def __str__(self):
return str(self.titre) + ' - ' + str(self.auteur.all().first())
return str(self.title) + ' - ' + str(self.authors.all().first())
class Meta:
verbose_name = _("medium")