lagt til Book.get_authors()
This commit is contained in:
parent
fddcfcbebe
commit
b1fa0c6fb6
|
@ -61,6 +61,13 @@ class Book(models.Model):
|
|||
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