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

lagt til Book.get_authors()

This commit is contained in:
Øyvind Almelid 2010-09-27 17:33:51 +00:00
parent fddcfcbebe
commit b1fa0c6fb6
1 changed files with 8 additions and 1 deletions

View File

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