diff --git a/python/web/library/models.py b/python/web/library/models.py index 5132062..e24b4f8 100644 --- a/python/web/library/models.py +++ b/python/web/library/models.py @@ -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