[finish #27470199] inactivate checked premium button no longer shows if there are no checked premiums

pull/1/head
eric 2012-04-05 22:44:45 -04:00
parent d2a0a6f49a
commit 147808bd88
2 changed files with 6 additions and 0 deletions

View File

@ -234,6 +234,10 @@ class Campaign(models.Model):
q = Q(campaign=self) | Q(campaign__isnull=True)
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):
# olib, ltwk, goog, gdrd, thng, isbn, oclc, olwk, olib
type = models.CharField(max_length=4, null=False)

View File

@ -87,7 +87,9 @@ The ending date can't be more than six months away- that's a practical limit for
</li>
{% endfor %}
</ul>
{% if campaign.custom_premiums.count %}
<input type="submit" name="inactivate" value="Inactivate Checked Premiums" />
{% endif %}
</form>
</div>
<h4>Add a custom premium for this campaign</h4>