[finish #27470199] inactivate checked premium button no longer shows if there are no checked premiums
parent
d2a0a6f49a
commit
147808bd88
|
@ -233,6 +233,10 @@ class Campaign(models.Model):
|
||||||
"""returns the available premiums for the Campaign including any default premiums"""
|
"""returns the available premiums for the Campaign including any default premiums"""
|
||||||
q = Q(campaign=self) | Q(campaign__isnull=True)
|
q = Q(campaign=self) | Q(campaign__isnull=True)
|
||||||
return Premium.objects.filter(q).exclude(type='XX').order_by('amount')
|
return Premium.objects.filter(q).exclude(type='XX').order_by('amount')
|
||||||
|
|
||||||
|
def custom_premiums(self):
|
||||||
|
"""returns only the active custoe premiums for the Campaign """
|
||||||
|
return Premium.objects.filter(campaign=self).filter(type='CU')
|
||||||
|
|
||||||
class Identifier(models.Model):
|
class Identifier(models.Model):
|
||||||
# olib, ltwk, goog, gdrd, thng, isbn, oclc, olwk, olib
|
# olib, ltwk, goog, gdrd, thng, isbn, oclc, olwk, olib
|
||||||
|
|
|
@ -87,7 +87,9 @@ The ending date can't be more than six months away- that's a practical limit for
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
{% if campaign.custom_premiums.count %}
|
||||||
<input type="submit" name="inactivate" value="Inactivate Checked Premiums" />
|
<input type="submit" name="inactivate" value="Inactivate Checked Premiums" />
|
||||||
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<h4>Add a custom premium for this campaign</h4>
|
<h4>Add a custom premium for this campaign</h4>
|
||||||
|
|
Loading…
Reference in New Issue