42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
from django.db import models
|
|
|
|
class Book(models.Model):
|
|
isbn = models.CharField(max_length=13)
|
|
# id = models.CharField(max_length=255, unique=True)
|
|
title = models.CharField(max_length=511)
|
|
subtitle = models.CharField(max_length=511)
|
|
# category =
|
|
publisher = models.CharField(max_length=255)
|
|
published_year = models.IntegerField()
|
|
edition = models.IntegerField()
|
|
num_pages = models.IntegerField()
|
|
# series =
|
|
description = models.CharField(max_length=1023)
|
|
picture = models.ImageField('%Y/%m/%d/pictures')
|
|
thumbnail = models.ImageField('%Y/%m/%d/thumbnails')
|
|
|
|
class BookSeries(models.Model):
|
|
title = models.CharField(max_length=500)
|
|
|
|
class AlternativeTitle(models.Model):
|
|
book = models.ForeignKey(Book)
|
|
alt_title = models.CharField(max_length=511)
|
|
|
|
class Copy(models.Model):
|
|
book = models.ForeignKey(Book)
|
|
number = models.IntegerField()
|
|
owner = models.CharField(max_length=255)
|
|
|
|
class Person(models.Model):
|
|
first_name = models.CharField(max_length=255)
|
|
last_name = models.CharField(max_length=255)
|
|
|
|
class BookPerson(models.Model):
|
|
book = models.ForeignKey(Book)
|
|
person = models.ForeignKey(Person)
|
|
relation = models.CharField(max_length=255)
|
|
|
|
class Reference(models.Model):
|
|
reference_type = models.CharField(max_length=255)
|
|
text = models.CharField(max_length=1023)
|