Projects/worblehat-old
Projects
/
worblehat-old
Archived
12
0
Fork 0

Satt opp web.library.models med en halvsakelig databasekonfigurasjon

This commit is contained in:
Øyvind Almelid 2010-09-17 17:24:29 +00:00
parent 2f872e99bf
commit 31f41575df
3 changed files with 43 additions and 27 deletions

8
db.txt
View File

@ -1,6 +1,6 @@
Tabeller: Tabeller:
bok (primærnøkkel: (isbn,id)) bok (primærnøkkel: (isbn))
isbn isbn
id (tekst) id (tekst)
tittel tittel
@ -20,11 +20,11 @@ bokserie
tittel tittel
alternativ_tittel alternativ_tittel
bok (isbn, id) bok (isbn)
alt_tittel alt_tittel
eksemplar eksemplar
bok (isbn, id) bok (isbn)
nummer nummer
eier («PVV» eller brukernavn) eier («PVV» eller brukernavn)
@ -34,7 +34,7 @@ person
fornavn fornavn
bokperson bokperson
bok (isbn, id) bok (isbn)
person (id) person (id)
relasjon (forfatter, redaktør, etc) relasjon (forfatter, redaktør, etc)

View File

@ -1,22 +1,27 @@
from django.db import models from django.db import models
class Book(models.Model): class Category(models.Model):
isbn = models.CharField(max_length=13) id = models.CharField(max_length=255, primary_key=True)
# id = models.CharField(max_length=255, unique=True) name = models.CharField(max_length=255)
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): class BookSeries(models.Model):
title = models.CharField(max_length=500) 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)
class AlternativeTitle(models.Model): class AlternativeTitle(models.Model):
book = models.ForeignKey(Book) book = models.ForeignKey(Book)
@ -25,17 +30,28 @@ class AlternativeTitle(models.Model):
class Copy(models.Model): class Copy(models.Model):
book = models.ForeignKey(Book) book = models.ForeignKey(Book)
number = models.IntegerField() number = models.IntegerField()
owner = models.CharField(max_length=255) owner = models.CharField(max_length=9)
class Person(models.Model): class Person(models.Model):
id = models.CharField(max_length=255, primary_key=True)
first_name = models.CharField(max_length=255) first_name = models.CharField(max_length=255)
last_name = models.CharField(max_length=255) last_name = models.CharField(max_length=255)
class Relation(models.Model):
name = models.CharField(max_length=31)
class BookPerson(models.Model): class BookPerson(models.Model):
book = models.ForeignKey(Book) book = models.ForeignKey(Book)
person = models.ForeignKey(Person) person = models.ForeignKey(Person)
relation = models.CharField(max_length=255) relation = models.ForeignKey(Relation)
class ReferenceType(models.Model):
name = models.CharField(max_length=31)
class Reference(models.Model): class Reference(models.Model):
reference_type = models.CharField(max_length=255) reference_type = models.ForeignKey(ReferenceType)
text = models.CharField(max_length=1023) text = models.CharField(max_length=1023)
class Placement(models.Model):
category = models.ForeignKey(Category)
shelf = models.CharField(max_length=10)

View File

@ -9,11 +9,11 @@ ADMINS = (
MANAGERS = ADMINS MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'web/test_database' # Or path to database file if using sqlite3. DATABASE_NAME = 'oysteini_pbb' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3. DATABASE_USER = 'oysteini_pbb' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3. DATABASE_PASSWORD = 'lio5Aide' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. DATABASE_HOST = 'postgres.pvv.ntnu.no' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
# Local time zone for this installation. Choices can be found here: # Local time zone for this installation. Choices can be found here: