diff --git a/python/web/library/models.py b/python/web/library/models.py index c54696f..6824a4b 100644 --- a/python/web/library/models.py +++ b/python/web/library/models.py @@ -123,6 +123,11 @@ class Book(models.Model): authors.append(person.person) return authors + def get_persons(self, relation): + return map(lambda bp: bp.person, + filter(lambda bp: bp.relation.name == relation, + self.persons.all())) + def __unicode__(self): return self.title