Also filter entries by expire_at in the news section of the home page
This commit is contained in:
parent
2d287dff32
commit
7d11a440c6
1 changed files with 5 additions and 1 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import translation
|
from django.utils import translation
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -320,7 +322,9 @@ class HomePage(Page):
|
||||||
@property
|
@property
|
||||||
def newsentries(self):
|
def newsentries(self):
|
||||||
# Get the last few news entries for the home page
|
# Get the last few news entries for the home page
|
||||||
entries = Entry.objects.all().order_by('-published')
|
entries = Entry.objects.filter(
|
||||||
|
models.Q(expire_at__isnull=True) | models.Q(expire_at__gt=datetime.datetime.now())
|
||||||
|
).all().order_by('-published')
|
||||||
# Filter out by current language
|
# Filter out by current language
|
||||||
curlang = translation.get_language()
|
curlang = translation.get_language()
|
||||||
if curlang in ['de']:
|
if curlang in ['de']:
|
||||||
|
|
Loading…
Reference in a new issue