keymedia/managemedia/models/books.py

17 lines
779 B
Python

from django.db import models
from .common import CommonMediaFields,MediaTypes
class Book(CommonMediaFields):
author = models.ForeignKey('Author', on_delete=models.CASCADE)
series = models.ForeignKey('Series', on_delete=models.CASCADE, blank=True)
series_entry = models.BooleanField('Series Entry', blank=True)
is_comic = models.BooleanField('Comic')
is_manga = models.BooleanField('Manga')
class Author(models.Model):
name = models.CharField('Author', max_length=256, unique=True)
sort_name = models.CharField('Author sort name', max_length=256, blank=True)
class Series(models.Model):
name = models.CharField('Series', unique=True, max_length=256)
total_entries = models.PositiveIntegerField('Total Entries', blank=True)