Skip to content

Commit

Permalink
Check the activity period in the content type too
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Jan 10, 2013
1 parent 01cae87 commit 33770e2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion feincms_banners/contents.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.db import models
from django.db.models import F
from django.template.loader import render_to_string
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _

from feincms_banners.models import Banner
Expand Down Expand Up @@ -31,7 +32,12 @@ class Meta:

def render(self, **kwargs):
if self.specific:
if self.specific.is_active:
if (self.specific.is_active
and self.specific.active_from <= timezone.now()
and (
not self.specific.active_until
or self.specific.active_until >= timezone.now()
)):
banner = self.specific
type = banner.type
else:
Expand Down

0 comments on commit 33770e2

Please sign in to comment.