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)
|
id = models.CharField(max_length=255, primary_key=True)
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
class BookSeries(models.Model):
|
class BookSeries(models.Model):
|
||||||
id = models.CharField(max_length=20, primary_key=True)
|
id = models.CharField(max_length=20, primary_key=True)
|
||||||
title = models.CharField(max_length=511)
|
title = models.CharField(max_length=511)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
class ReferenceType(models.Model):
|
class ReferenceType(models.Model):
|
||||||
name = models.CharField(max_length=31)
|
name = models.CharField(max_length=31)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
class Reference(models.Model):
|
class Reference(models.Model):
|
||||||
reference_type = models.ForeignKey(ReferenceType)
|
reference_type = models.ForeignKey(ReferenceType)
|
||||||
text = models.CharField(max_length=1023)
|
text = models.CharField(max_length=1023)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.text
|
||||||
|
|
||||||
class Book(models.Model):
|
class Book(models.Model):
|
||||||
isbn = models.CharField(max_length=13, primary_key=True)
|
isbn = models.CharField(max_length=13, primary_key=True)
|
||||||
# id = models.CharField(max_length=255)
|
# id = models.CharField(max_length=255)
|
||||||
|
@ -77,14 +89,21 @@ class Id(models.Model):
|
||||||
id = models.CharField(max_length=511, primary_key=True)
|
id = models.CharField(max_length=511, primary_key=True)
|
||||||
book = models.OneToOneField(Book)
|
book = models.OneToOneField(Book)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
class AlternativeTitle(models.Model):
|
class AlternativeTitle(models.Model):
|
||||||
book = models.ForeignKey(Book, related_name='alt_titles')
|
book = models.ForeignKey(Book, related_name='alt_titles')
|
||||||
alt_title = models.CharField(max_length=511)
|
alt_title = models.CharField(max_length=511)
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.book.title+"="+self.alt_title
|
||||||
|
|
||||||
class Copy(models.Model):
|
class Copy(models.Model):
|
||||||
book = models.ForeignKey(Book, related_name='copies')
|
book = models.ForeignKey(Book, related_name='copies')
|
||||||
number = models.IntegerField()
|
number = models.IntegerField()
|
||||||
owner = models.CharField(max_length=9)
|
owner = models.CharField(max_length=9)
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.book.title+" "+str(self.number)+" "+self.owner
|
||||||
|
|
||||||
class Person(models.Model):
|
class Person(models.Model):
|
||||||
id = models.CharField(max_length=255, primary_key=True)
|
id = models.CharField(max_length=255, primary_key=True)
|
||||||
|
@ -112,3 +131,6 @@ class BookPerson(models.Model):
|
||||||
class Placement(models.Model):
|
class Placement(models.Model):
|
||||||
category = models.ForeignKey(Category)
|
category = models.ForeignKey(Category)
|
||||||
shelf = models.CharField(max_length=10)
|
shelf = models.CharField(max_length=10)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.category.name+" at "+self.shelf
|
||||||
|
|
Reference in New Issue