keymedia/managemedia/models/books.py

17 lines
779 B
Python
Raw Normal View History

2020-06-08 20:25:22 -04:00
from django.db import models
2020-06-12 17:49:58 -04:00
from .common import CommonMediaFields,MediaTypes
2020-06-12 11:17:30 -04:00
class Book(CommonMediaFields):
2020-06-12 15:43:36 -04:00
author = models.ForeignKey('Author', on_delete=models.CASCADE)
series = models.ForeignKey('Series', on_delete=models.CASCADE, blank=True)
2020-06-08 20:25:22 -04:00
series_entry = models.BooleanField('Series Entry', blank=True)
is_comic = models.BooleanField('Comic')
is_manga = models.BooleanField('Manga')
2020-06-12 11:17:30 -04:00
class Author(models.Model):
2020-06-12 17:49:58 -04:00
name = models.CharField('Author', max_length=256, unique=True)
sort_name = models.CharField('Author sort name', max_length=256, blank=True)
2020-06-08 20:25:22 -04:00
2020-06-12 11:17:30 -04:00
class Series(models.Model):
2020-06-12 17:49:58 -04:00
name = models.CharField('Series', unique=True, max_length=256)
2020-06-08 20:25:22 -04:00
total_entries = models.PositiveIntegerField('Total Entries', blank=True)