2010-09-17 17:14:10 +02:00
|
|
|
from django.db import models
|
|
|
|
|
2010-09-17 19:24:29 +02:00
|
|
|
class Category(models.Model):
|
|
|
|
id = models.CharField(max_length=255, primary_key=True)
|
|
|
|
name = models.CharField(max_length=255)
|
2010-09-17 17:14:10 +02:00
|
|
|
|
|
|
|
class BookSeries(models.Model):
|
2010-09-17 19:24:29 +02:00
|
|
|
id = models.CharField(max_length=20, primary_key=True)
|
|
|
|
title = models.CharField(max_length=511)
|
|
|
|
|
|
|
|
class Book(models.Model):
|
|
|
|
isbn = models.CharField(max_length=13, primary_key=True)
|
|
|
|
id = models.CharField(max_length=255, unique=True)
|
|
|
|
title = models.CharField(max_length=511)
|
|
|
|
subtitle = models.CharField(max_length=511, null=True, blank=True)
|
|
|
|
category = models.ForeignKey(Category)
|
|
|
|
publisher = models.CharField(max_length=255, null=True, blank=True)
|
|
|
|
published_year = models.IntegerField(null=True, blank=True)
|
|
|
|
edition = models.IntegerField(null=True, blank=True)
|
|
|
|
num_pages = models.IntegerField(null=True, blank=True)
|
|
|
|
series = models.ForeignKey(BookSeries, null=True, blank=True)
|
|
|
|
description = models.CharField(max_length=1023, null=True, blank=True)
|
|
|
|
picture = models.ImageField(upload_to='%Y/%m/%d/pictures', null=True, blank=True)
|
|
|
|
thumbnail = models.ImageField(upload_to='%Y/%m/%d/thumbnails', null=True, blank=True)
|
2010-09-17 17:14:10 +02:00
|
|
|
|
|
|
|
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()
|
2010-09-17 19:24:29 +02:00
|
|
|
owner = models.CharField(max_length=9)
|
2010-09-17 17:14:10 +02:00
|
|
|
|
|
|
|
class Person(models.Model):
|
2010-09-17 19:24:29 +02:00
|
|
|
id = models.CharField(max_length=255, primary_key=True)
|
2010-09-17 17:14:10 +02:00
|
|
|
first_name = models.CharField(max_length=255)
|
|
|
|
last_name = models.CharField(max_length=255)
|
|
|
|
|
2010-09-17 19:24:29 +02:00
|
|
|
class Relation(models.Model):
|
|
|
|
name = models.CharField(max_length=31)
|
|
|
|
|
2010-09-17 17:14:10 +02:00
|
|
|
class BookPerson(models.Model):
|
|
|
|
book = models.ForeignKey(Book)
|
|
|
|
person = models.ForeignKey(Person)
|
2010-09-17 19:24:29 +02:00
|
|
|
relation = models.ForeignKey(Relation)
|
|
|
|
|
|
|
|
class ReferenceType(models.Model):
|
|
|
|
name = models.CharField(max_length=31)
|
2010-09-17 17:14:10 +02:00
|
|
|
|
|
|
|
class Reference(models.Model):
|
2010-09-17 19:24:29 +02:00
|
|
|
reference_type = models.ForeignKey(ReferenceType)
|
2010-09-17 17:14:10 +02:00
|
|
|
text = models.CharField(max_length=1023)
|
2010-09-17 19:24:29 +02:00
|
|
|
|
|
|
|
class Placement(models.Model):
|
|
|
|
category = models.ForeignKey(Category)
|
|
|
|
shelf = models.CharField(max_length=10)
|