Removing Work.status because it doesn't meet current needs for how we think of the status of a work.

pull/1/head
Raymond Yee 2011-10-19 10:41:13 -07:00
parent 0ed1d229f5
commit ce9f04619a
1 changed files with 1 additions and 24 deletions

View File

@ -104,30 +104,7 @@ class Work(models.Model):
def cover_image_small(self):
server_id = random.randint(0, 9)
gb_id = self.editions.all()[0].googlebooks_id
return "http://bks%i.books.google.com/books?id=%s&printsec=frontcover&img=1&zoom=5" % (server_id, gb_id)
@property
def status(self):
"""status based on associated campaigns if any."""
campaigns = self.campaigns.all()
unglued = False
active = False
for c in campaigns:
status = c.status
if status == 'ACTIVE':
active = True
elif status == 'SUCCESSFUL':
unglued = True
if unglued:
return 'UNGLUED'
elif active:
return 'ACTIVE CAMPAIGN'
else:
return 'NO ACTIVE CAMPAIGN'
return "http://bks%i.books.google.com/books?id=%s&printsec=frontcover&img=1&zoom=5" % (server_id, gb_id)
def __unicode__(self):
return self.title