La til funksjon Book.get_persons.

This commit is contained in:
Øystein Ingmar Skartsæterhagen 2011-03-06 17:41:44 +00:00
parent 136d1dd7c3
commit 7716c61965

View File

@ -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