diff options
-rwxr-xr-x | setup.py | 3 | ||||
-rw-r--r-- | weblog/feeds.py | 6 |
2 files changed, 6 insertions, 3 deletions
@@ -10,7 +10,7 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='w3blog', - version='0.4.3', + version='0.4-testing.18', packages=find_packages(), include_package_data=True, license='BSD License', @@ -32,6 +32,7 @@ setup( 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', ], diff --git a/weblog/feeds.py b/weblog/feeds.py index 59fcd8f..bb5c65c 100644 --- a/weblog/feeds.py +++ b/weblog/feeds.py @@ -5,6 +5,7 @@ from weblog.models import BlogPost, Translation, Category, CategoryTranslation from weblog.apps import SETTINGS as blog_settings from django.utils.translation import ugettext_lazy as _, pgettext_lazy from django.utils import translation +import datetime class BlogFeed(Feed): @@ -43,9 +44,10 @@ class BlogFeed(Feed): return _('Latest blog posts on %(blog_title)s') % {'blog_title': blog_settings['blog_title']} def items(self, obj): + now = datetime.datetime.now() if obj: - return BlogPost.objects.filter(category__slug=obj).order_by('-publish_date')[:blog_settings['posts_per_page']] - return BlogPost.objects.order_by('-publish_date')[:blog_settings['posts_per_page']] + return BlogPost.objects.filter(category__slug=obj, published=True, publish_date__lte=now).order_by('-publish_date')[:blog_settings['posts_per_page']] + return BlogPost.objects.order_by('-publish_date').filter(published=True, publish_date__lte=now)[:blog_settings['posts_per_page']] def item_title(self, item): translation_exists = False |