fix edit_feed redirect, add edit_feed link to feed view

This commit is contained in:
Trent Palmer 2021-03-02 19:37:48 -08:00
parent 2b10df12ed
commit 8cf2ba0edf
2 changed files with 11 additions and 3 deletions

View File

@ -17,6 +17,13 @@
<div class="col-0 col-sm-3">
</div>
<div class="col-12 col-sm-6 px-0 mx-0">
{% if user.is_authenticated %}
{% if view == 'feed' %}
<div class="text-center mb-3">
<a href="{% url 'audio:edit_feed' pk=feed_pk title_slug=feed_slug %}">Edit Feed?</a>
</div>
{% endif %}
{% endif %}
{% for j in episodes %}
<div class="card mx-1 mb-3">
<h3 class="text-center mt-2">

View File

@ -19,8 +19,9 @@ def feed(request, pk, slug):
return render(
request, 'audio/index.html',
{
'episodes': episodes, 'IMAGES_URL': IMAGES_URL,
'MP3_URL': MP3_URL, 'title': feed.title, 'heading': feed.title
'episodes': episodes, 'IMAGES_URL': IMAGES_URL, 'view': 'feed',
'MP3_URL': MP3_URL, 'title': feed.title, 'heading': feed.title,
'feed_pk': pk, 'feed_slug': slug,
})
@ -70,7 +71,7 @@ def edit_feed(request, pk, title_slug):
form = FeedForm(request.POST, request.FILES, instance=feed)
if form.is_valid():
feed.save()
return redirect('audio:new_feed')
return redirect('audio:feed', pk=pk, slug=title_slug)
else:
form = FeedForm(instance=feed)
return render(