Fikset noen rare ting angående id-feltet til bok.
This commit is contained in:
parent
342ebc2950
commit
5ed2572cf6
|
@ -46,23 +46,16 @@ class Book(models.Model):
|
|||
print '%-15s: %50s' % (field[1], '')
|
||||
|
||||
def getid(self):
|
||||
try:
|
||||
if self.id:
|
||||
return self.id.id
|
||||
except Id.DoesNotExist:
|
||||
return None
|
||||
|
||||
def setid(self,newid):
|
||||
try:
|
||||
id = self.id
|
||||
id.delete()
|
||||
if self.id:
|
||||
self.id.delete()
|
||||
newid = Id(book=self,id=newid)
|
||||
newid.save()
|
||||
|
||||
except Id.DoesNotExist:
|
||||
id=Id(id=newid,book=self)
|
||||
id.save()
|
||||
# return Book.get(isbn=self.isbn)
|
||||
|
||||
def get_authors(self):
|
||||
people = self.persons.all()
|
||||
authors = []
|
||||
|
|
Reference in New Issue