Skip to content

Commit 522c59b

Browse files
committed
Adding external topics page
1 parent df71da5 commit 522c59b

File tree

4 files changed

+18
-31
lines changed

4 files changed

+18
-31
lines changed

main.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
# coding: utf-8
22

33
from quokka.core.app import QuokkaModule
4-
from .views import ExternalBlogListView
5-
from .utils import get_external_blog
4+
from .views import AggregatedTopicsListView
65

76

87
module = QuokkaModule("rssaggregator", __name__, template_folder="templates")
9-
module.add_url_rule('/rssaggregator/', view_func=ExternalBlogListView.as_view('external blogs'))
10-
11-
#module.add_app_template_global(get_external_blog)
8+
module.add_url_rule('/aggregated-topics/', view_func=AggregatedTopicsListView.as_view('aggregated topic'))

templates/RSSaggregator/external_topics_list.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44
<div class="large-12 columns">
55
<table class="large-12">
66
<thead>
7-
<tr>Name</tr>
8-
<tr>Root URL</tr>
9-
<tr>Feeds URL</tr>
7+
<tr>Title</tr>
8+
<tr>Description</tr>
9+
<tr>Topic URL</tr>
10+
<tr>Date</tr>
1011
</thead>
11-
1212
<tbody>
13-
{% for blog in blogs %}
14-
<td>{{ blog.name }}</td>
15-
<td>{{ blog.root_url }}</td>
16-
<td>{{ blog.feeds_url }}</td>
13+
{% for topic in topics %}
14+
<td>{{ topic.title }}</td>
15+
<td>{{ topic.description }}</td>
16+
<td>{{ topic.topic_url }}</td>
17+
<td>{{ topic.date }}</td>
1718
{% endfor %}
1819
</tbody>
1920
</table>

utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# coding: utf-8
2-
from .models import ExternalBlogs
2+
from .models import AggregatedTopic
33

44

5-
def get_external_blog(**kwargs):
6-
blogs = ExternalBlogs.objects(**kwargs)
5+
def get_external_topic(**kwargs):
6+
topics = AggregatedTopic.objects(**kwargs)
77

8-
return blogs.order_by('name')
8+
return topics.order_by('date')
99

views.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,13 @@
33

44
from flask.views import MethodView
55
from quokka.core.templates import render_template
6-
from .utils import get_external_blog
6+
from .utils import get_external_topic
77

88

9-
class ExternalBlogListView(MethodView):
9+
class AggregatedTopicsListView(MethodView):
1010
"""
1111
Show a full list of external blogs
1212
"""
1313

1414
def get(self):
15-
return render_template('RSSaggregator/blogs_list.html', blogs=get_external_blog())
16-
17-
18-
'''class ExternalBlogView(MethodView):
19-
"""
20-
Show specific external blog
21-
"""
22-
23-
def get(self, blog_id):
24-
blog = get_external_blog(blog_id=blog_id)
25-
contents = get_author_contents(author)
26-
return render_template('authors/detail.html',author=author, contents=contents)'''
15+
return render_template('RSSaggregator/external_topics_list.html', topics=get_external_topic())

0 commit comments

Comments
 (0)