added a campaign.rightsholder property to make it not annoying to put rh names into templates
parent
6fe7aeeabb
commit
33f7c99a5b
|
@ -212,7 +212,7 @@ class Campaign(models.Model):
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
ungluers = self.work.wished_by()
|
ungluers = self.work.wished_by()
|
||||||
notification.queue(ungluers, "wishlist_active", {'campaign':self, 'active_claim':active_claim, 'site': Site.objects.get_current()}, True)
|
notification.queue(ungluers, "wishlist_active", {'campaign':self, 'site': Site.objects.get_current()}, True)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,6 +263,18 @@ class Campaign(models.Model):
|
||||||
"""returns only the active custom premiums for the Campaign"""
|
"""returns only the active custom premiums for the Campaign"""
|
||||||
return Premium.objects.filter(campaign=self).filter(type='CU')
|
return Premium.objects.filter(campaign=self).filter(type='CU')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def rightsholder(self):
|
||||||
|
"""returns the name of the rights holder for an active or initialized campaign"""
|
||||||
|
try:
|
||||||
|
if self.status=='ACTIVE' or self.status=='INITIALIZED':
|
||||||
|
q = Q(status='ACTIVE') | Q(status='INITIALIZED')
|
||||||
|
rh = self.work.claim.filter(q)[0].rights_holder.rights_holder_name
|
||||||
|
return rh
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return ''
|
||||||
|
|
||||||
class Identifier(models.Model):
|
class Identifier(models.Model):
|
||||||
# olib, ltwk, goog, gdrd, thng, isbn, oclc, olwk, olib, gute, glue
|
# olib, ltwk, goog, gdrd, thng, isbn, oclc, olwk, olib, gute, glue
|
||||||
type = models.CharField(max_length=4, null=False)
|
type = models.CharField(max_length=4, null=False)
|
||||||
|
|
Loading…
Reference in New Issue