lagt til Book.get_authors()
This commit is contained in:
parent
fddcfcbebe
commit
b1fa0c6fb6
|
@ -60,7 +60,14 @@ class Book(models.Model):
|
|||
id=Id(id=newid,book=self)
|
||||
id.save()
|
||||
# return Book.get(isbn=self.isbn)
|
||||
|
||||
|
||||
def get_authors(self):
|
||||
people = self.person.all()
|
||||
authors = []
|
||||
for person in people:
|
||||
if person.relation.name == 'Author':
|
||||
authors.append(person.person)
|
||||
return authors
|
||||
|
||||
def __unicode__(self):
|
||||
return self.title
|
||||
|
|
Reference in New Issue