aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsetup.py2
-rwxr-xr-xweblog/apps.py1
-rw-r--r--weblog/feeds.py14
-rwxr-xr-xweblog/urls.py10
4 files changed, 11 insertions, 16 deletions
diff --git a/setup.py b/setup.py
index 0c50bb1..e9136d0 100755
--- a/setup.py
+++ b/setup.py
@@ -9,7 +9,7 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-weblog',
- version='0.3-rss.3',
+ version='0.3-rss.4',
packages=find_packages(),
include_package_data=True,
license='BSD License',
diff --git a/weblog/apps.py b/weblog/apps.py
index 6f2db71..cc800c1 100755
--- a/weblog/apps.py
+++ b/weblog/apps.py
@@ -12,6 +12,7 @@ SETTINGS = {
'show_categories': False,
'show_archive': True,
'posts_per_page': 10,
+ 'enable_rss': True,
}
class WeblogConfig(AppConfig):
diff --git a/weblog/feeds.py b/weblog/feeds.py
index d7ccb23..7e567c2 100644
--- a/weblog/feeds.py
+++ b/weblog/feeds.py
@@ -5,20 +5,6 @@ from weblog.apps import SETTINGS as blog_settings
from django.utils.translation import ugettext_lazy as _, pgettext_lazy
from django.utils import translation
-class MainFeed(Feed):
- title = _('%(blog_title)s RSS feed') % {'blog_title': blog_settings['blog_title']}
- link = reverse('weblog:Index')
- description = _('Latest blog posts on %(blog_title)s') % {'blog_title': blog_settings['blog_title']}
-
- def items(self):
- return BlogPost.objects.order_by('-publish_date')[:blog_settings['posts_per_page']]
-
- def item_title(self, item):
- return item.title
-
- def item_description(self, item):
- return item.content
-
class BlogFeed(Feed):
def get_object(self, request, category_slug=None):
diff --git a/weblog/urls.py b/weblog/urls.py
index 643e8c7..4d6a325 100755
--- a/weblog/urls.py
+++ b/weblog/urls.py
@@ -1,5 +1,7 @@
from django.conf.urls import url
from . import views
+from weblog.feeds import BlogFeed
+from weblog.apps import SETTINGS as blog_settings
app_name = 'weblog'
urlpatterns = [
@@ -9,4 +11,10 @@ urlpatterns = [
url(r'^(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/$', views.Index, name='ArchiveIndex'),
url(r'^(?P<category_slug>[-\w]+)/$', views.Index, name='CategoryIndex'),
url(r'^(?P<category_slug>[-\w]+)/(?P<post_slug>[-\w]+)/$', views.PostView, name='PostView'),
-] \ No newline at end of file
+]
+
+if blog_settings['enable_rss']:
+ urlpatters += [
+ url(r'^/rss/$', BlogFeed(), name='RSS'),
+ url(r'^/(?P<category_slug>[-\w]+)/rss/$', BlogFeed(), name='CategoryRSS'),
+ ]