Projects/worblehat-old
Projects
/
worblehat-old
Archived
12
0
Fork 0

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
1 changed files with 5 additions and 0 deletions

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