Merge pull request #592 from Gluejar/fix-preferred-edition
squash the missing edition problempull/1/head
commit
5a22544d11
|
@ -1123,8 +1123,12 @@ class Work(models.Model):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def googlebooks_id(self):
|
def googlebooks_id(self):
|
||||||
preferred_id=self.preferred_edition.googlebooks_id
|
try:
|
||||||
# note that there's always a preferred edition
|
preferred_id=self.preferred_edition.googlebooks_id
|
||||||
|
# note that there should always be a preferred edition
|
||||||
|
except AttributeError:
|
||||||
|
# this work has no edition.
|
||||||
|
return ''
|
||||||
if preferred_id:
|
if preferred_id:
|
||||||
return preferred_id
|
return preferred_id
|
||||||
try:
|
try:
|
||||||
|
@ -1307,6 +1311,7 @@ class Work(models.Model):
|
||||||
return WasWork.objects.get(was=self.id).work.preferred_edition
|
return WasWork.objects.get(was=self.id).work.preferred_edition
|
||||||
except WasWork.DoesNotExist:
|
except WasWork.DoesNotExist:
|
||||||
#should not happen
|
#should not happen
|
||||||
|
logger.warning('work {} has no edition'.format(self.id))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def last_campaign_status(self):
|
def last_campaign_status(self):
|
||||||
|
|
Loading…
Reference in New Issue