la til unicode-metoder på alle modellene
This commit is contained in:
parent
256561147a
commit
f76e01a641
|
@ -9,17 +9,29 @@ class Category(models.Model):
|
|||
id = models.CharField(max_length=255, primary_key=True)
|
||||
name = models.CharField(max_length=255)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
||||
class BookSeries(models.Model):
|
||||
id = models.CharField(max_length=20, primary_key=True)
|
||||
title = models.CharField(max_length=511)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.title
|
||||
|
||||
class ReferenceType(models.Model):
|
||||
name = models.CharField(max_length=31)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
||||
class Reference(models.Model):
|
||||
reference_type = models.ForeignKey(ReferenceType)
|
||||
text = models.CharField(max_length=1023)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.text
|
||||
|
||||
class Book(models.Model):
|
||||
isbn = models.CharField(max_length=13, primary_key=True)
|
||||
# id = models.CharField(max_length=255)
|
||||
|
@ -77,14 +89,21 @@ class Id(models.Model):
|
|||
id = models.CharField(max_length=511, primary_key=True)
|
||||
book = models.OneToOneField(Book)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.id
|
||||
|
||||
class AlternativeTitle(models.Model):
|
||||
book = models.ForeignKey(Book, related_name='alt_titles')
|
||||
alt_title = models.CharField(max_length=511)
|
||||
def __unicode__(self):
|
||||
return self.book.title+"="+self.alt_title
|
||||
|
||||
class Copy(models.Model):
|
||||
book = models.ForeignKey(Book, related_name='copies')
|
||||
number = models.IntegerField()
|
||||
owner = models.CharField(max_length=9)
|
||||
def __unicode__(self):
|
||||
return self.book.title+" "+str(self.number)+" "+self.owner
|
||||
|
||||
class Person(models.Model):
|
||||
id = models.CharField(max_length=255, primary_key=True)
|
||||
|
@ -112,3 +131,6 @@ class BookPerson(models.Model):
|
|||
class Placement(models.Model):
|
||||
category = models.ForeignKey(Category)
|
||||
shelf = models.CharField(max_length=10)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.category.name+" at "+self.shelf
|
||||
|
|
Reference in New Issue