need ['value'] to access value not .value

pull/1/head
Raymond Yee 2013-04-02 23:01:24 -07:00
parent 05d07f8712
commit d26e97f883
1 changed files with 11 additions and 11 deletions

View File

@ -622,7 +622,7 @@ class Work(models.Model):
if preferred_id: if preferred_id:
return preferred_id return preferred_id
try: try:
return self.identifiers.values('type', 'value').filter(type='goog')[0].value return self.identifiers.values('type', 'value').filter(type='goog')[0]['value']
except IndexError: except IndexError:
return '' return ''
@ -639,7 +639,7 @@ class Work(models.Model):
if preferred_id: if preferred_id:
return preferred_id return preferred_id
try: try:
return self.identifiers.values('type', 'value').filter(type='gdrd')[0].value return self.identifiers.values('type', 'value').filter(type='gdrd')[0]['value']
except IndexError: except IndexError:
return '' return ''
@ -650,7 +650,7 @@ class Work(models.Model):
@property @property
def librarything_id(self): def librarything_id(self):
try: try:
return self.identifiers.values('type', 'value').filter(type='ltwk')[0].value return self.identifiers.values('type', 'value').filter(type='ltwk')[0]['value']
except IndexError: except IndexError:
return '' return ''
@ -661,7 +661,7 @@ class Work(models.Model):
@property @property
def openlibrary_id(self): def openlibrary_id(self):
try: try:
return self.identifiers.values('type', 'value').filter(type='olwk')[0].value return self.identifiers.values('type', 'value').filter(type='olwk')[0]['value']
except IndexError: except IndexError:
return '' return ''
@ -793,7 +793,7 @@ class Work(models.Model):
if preferred_id: if preferred_id:
return preferred_id return preferred_id
try: try:
return self.identifiers.filter(type='oclc')[0].value return self.identifiers.filter(type='oclc')[0]['value']
except IndexError: except IndexError:
return '' return ''
@ -802,7 +802,7 @@ class Work(models.Model):
if preferred_id: if preferred_id:
return preferred_id return preferred_id
try: try:
return self.identifiers.filter(type='isbn')[0].value return self.identifiers.filter(type='isbn')[0]['value']
except IndexError: except IndexError:
return '' return ''
@ -920,35 +920,35 @@ class Edition(models.Model):
@property @property
def isbn_13(self): def isbn_13(self):
try: try:
return self.identifiers.filter(type='isbn')[0].value return self.identifiers.filter(type='isbn')[0]['value']
except IndexError: except IndexError:
return '' return ''
@property @property
def googlebooks_id(self): def googlebooks_id(self):
try: try:
return self.identifiers.filter(type='goog')[0].value return self.identifiers.filter(type='goog')[0]['value']
except IndexError: except IndexError:
return '' return ''
@property @property
def librarything_id(self): def librarything_id(self):
try: try:
return self.identifiers.filter(type='thng')[0].value return self.identifiers.filter(type='thng')[0]['value']
except IndexError: except IndexError:
return '' return ''
@property @property
def oclc(self): def oclc(self):
try: try:
return self.identifiers.filter(type='oclc')[0].value return self.identifiers.filter(type='oclc')[0]['value']
except IndexError: except IndexError:
return '' return ''
@property @property
def goodreads_id(self): def goodreads_id(self):
try: try:
return self.identifiers.filter(type='gdrd')[0].value return self.identifiers.filter(type='gdrd')[0]['value']
except IndexError: except IndexError:
return '' return ''