From c14ccf7079c8d68473e80df9c20aaac735f69447 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 23 May 2013 00:35:46 +0200 Subject: Add the all category and show feeds on page --- ryuslash/aggregator/models.py | 7 ++++-- ryuslash/aggregator/templates/aggregator/base.html | 9 +++++--- .../aggregator/templates/aggregator/posts.html | 13 +++++++++-- ryuslash/aggregator/views.py | 27 +++++++++++----------- ryuslash/urls.py | 7 ++++-- 5 files changed, 41 insertions(+), 22 deletions(-) diff --git a/ryuslash/aggregator/models.py b/ryuslash/aggregator/models.py index 3ca7df2..9a39600 100644 --- a/ryuslash/aggregator/models.py +++ b/ryuslash/aggregator/models.py @@ -1,5 +1,7 @@ from django.db import models +CATEGORIES = ['post', 'activity'] + class Feed(models.Model): name = models.CharField(max_length=300) @@ -9,8 +11,9 @@ class Feed(models.Model): uses_markdown = models.BooleanField() uses_titles = models.BooleanField() convert_newlines = models.BooleanField() - category = models.SmallIntegerField(choices=((0, 'post'), - (1, 'activity'))) + category = models.SmallIntegerField( + choices=[(CATEGORIES.index(c), c) for c in CATEGORIES] + ) def __unicode__(self): return self.name diff --git a/ryuslash/aggregator/templates/aggregator/base.html b/ryuslash/aggregator/templates/aggregator/base.html index 1b674aa..499e02a 100644 --- a/ryuslash/aggregator/templates/aggregator/base.html +++ b/ryuslash/aggregator/templates/aggregator/base.html @@ -16,13 +16,16 @@
ryuslash.org - ryuslash + ryuslash
diff --git a/ryuslash/aggregator/templates/aggregator/posts.html b/ryuslash/aggregator/templates/aggregator/posts.html index 851a95e..0a97729 100644 --- a/ryuslash/aggregator/templates/aggregator/posts.html +++ b/ryuslash/aggregator/templates/aggregator/posts.html @@ -11,6 +11,15 @@

+
+ Feeds: + {% for feed in feeds %} + + {{ feed.name }} + + {% empty %} +
None... + {% endfor %}
{% for post in list.object_list %} @@ -44,7 +53,7 @@