Tag timelines implemented, but not reachable from anywhere

Except knowing the URL, of course.
This commit is contained in:
Jason McBrayer 2018-05-06 19:46:51 -04:00
parent d39593868d
commit 7b4c449179
3 changed files with 15 additions and 1 deletions

View File

@ -6,12 +6,13 @@
{% endblock %}
{% block content %}
{% if form %}
<h1 class="title">Post</h1>
<div class="box">
{% include "main/post_partial.html" %}
</div>
<hr class="is-hidden">
{% endif %}
<h1 class="title">Your {{ timeline }} timeline</h1>
{% for toot in toots %}
<div class="box">

View File

@ -28,6 +28,7 @@ urlpatterns = [
path('fed', views.fed, name='fed'),
path('settings', views.settings, name='settings'),
path('thread/<int:id>', views.thread, name='thread'),
path('tags/<tag>', views.tag, name='tag'),
path('toot', views.toot, name="toot"),
path('reply/<int:id>', views.reply, name='reply'),
path('fav/<int:id>', views.fav, name='fav'),

View File

@ -60,6 +60,18 @@ def local(request):
def fed(request):
return timeline(request, 'public', 'Federated')
@never_cache
def tag(request, tag):
try:
mastodon = get_mastodon(request)
except NotLoggedInException:
return redirect(login)
data = mastodon.timeline_hashtag(tag)
return render(request, 'main/timeline.html',
{'toots': data, 'timeline': '#'+tag,
'fullbrutalism': fullbrutalism_p(request)})
def login(request):
if request.method == "GET":
form = LoginForm()