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

Fikset noen rare ting angående id-feltet til bok.

This commit is contained in:
Øystein Ingmar Skartsæterhagen 2011-03-04 13:37:00 +00:00
parent 342ebc2950
commit 5ed2572cf6
1 changed files with 6 additions and 13 deletions

View File

@ -46,23 +46,16 @@ class Book(models.Model):
print '%-15s: %50s' % (field[1], '') print '%-15s: %50s' % (field[1], '')
def getid(self): def getid(self):
try: if self.id:
return self.id.id return self.id.id
except Id.DoesNotExist:
return None return None
def setid(self,newid): def setid(self,newid):
try: if self.id:
id = self.id self.id.delete()
id.delete()
newid = Id(book=self,id=newid) newid = Id(book=self,id=newid)
newid.save() newid.save()
except Id.DoesNotExist:
id=Id(id=newid,book=self)
id.save()
# return Book.get(isbn=self.isbn)
def get_authors(self): def get_authors(self):
people = self.persons.all() people = self.persons.all()
authors = [] authors = []