djangoting
This commit is contained in:
0
python/web/library/__init__.py
Normal file
0
python/web/library/__init__.py
Normal file
41
python/web/library/models.py
Normal file
41
python/web/library/models.py
Normal file
@ -0,0 +1,41 @@
|
||||
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)
|
23
python/web/library/tests.py
Normal file
23
python/web/library/tests.py
Normal file
@ -0,0 +1,23 @@
|
||||
"""
|
||||
This file demonstrates two different styles of tests (one doctest and one
|
||||
unittest). These will both pass when you run "manage.py test".
|
||||
|
||||
Replace these with more appropriate tests for your application.
|
||||
"""
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
class SimpleTest(TestCase):
|
||||
def test_basic_addition(self):
|
||||
"""
|
||||
Tests that 1 + 1 always equals 2.
|
||||
"""
|
||||
self.failUnlessEqual(1 + 1, 2)
|
||||
|
||||
__test__ = {"doctest": """
|
||||
Another way to test that 1 + 1 is equal to 2.
|
||||
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
1
python/web/library/views.py
Normal file
1
python/web/library/views.py
Normal file
@ -0,0 +1 @@
|
||||
# Create your views here.
|
Reference in New Issue
Block a user