djangoting

This commit is contained in:
2010-09-17 15:14:10 +00:00
parent 4a303fd847
commit 2f872e99bf
8 changed files with 174 additions and 0 deletions

View File

View 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)

View 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
"""}

View File

@@ -0,0 +1 @@
# Create your views here.