fixed return after editing a entry
This commit is contained in:
@@ -59,7 +59,7 @@
|
||||
</p>
|
||||
<br />
|
||||
<div class="mb-3">
|
||||
<a class="btn btn-light" href="{{ request.route_url('topic', topic=entry.topic_id) }}">Retour</a>
|
||||
<a class="btn btn-light" href="{{ url_retour }}">Retour</a>
|
||||
<button class="btn btn-primary" type="submit" name="form.submitted">Enregistrer</button>
|
||||
{% if blog_id != '0' %}
|
||||
<button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#confirmDelete">Supprimer</button>
|
||||
|
||||
@@ -84,14 +84,17 @@ def blog_edit(request):
|
||||
entry['creator'] = request.authenticated_userid
|
||||
entry['editor'] = ''
|
||||
page_title = 'Nouvelle page'
|
||||
url_retour = request.route_url('topic', topic=topic)
|
||||
|
||||
else:
|
||||
# modify post
|
||||
entry = get_entries_by_id(request, blog_id)
|
||||
if not entry:
|
||||
request.session.flash("Page non trouvée : %s" % blog_id, 'warning')
|
||||
return HTTPFound(location=request.route_url('topic', topic=topic))
|
||||
return HTTPFound(url_retour)
|
||||
page_title = 'Modifier : ' + entry.title
|
||||
entry_slug = urlify(entry.title)
|
||||
url_retour = request.route_url('blog', id=blog_id, slug=entry_slug)
|
||||
|
||||
if 'form.submitted' in request.params:
|
||||
new_values = {}
|
||||
@@ -109,16 +112,17 @@ def blog_edit(request):
|
||||
new_values['topic_id'] = topic
|
||||
new_values['editor'] = request.authenticated_userid
|
||||
update_entry(request, blog_id, new_values)
|
||||
return HTTPFound(location=request.route_url('topic', topic=topic))
|
||||
return HTTPFound(location=url_retour)
|
||||
|
||||
if 'form.deleted' in request.params:
|
||||
delete_entry(request, blog_id)
|
||||
request.session.flash("La page a été supprimée avec succès.", 'success')
|
||||
return HTTPFound(location=request.route_url('topic', topic=topic))
|
||||
return HTTPFound(location=url_retour)
|
||||
|
||||
return {
|
||||
'page_title': page_title,
|
||||
'url': url,
|
||||
'url_retour': url_retour,
|
||||
'blog_id': blog_id,
|
||||
'entry': entry,
|
||||
'tags': tags,
|
||||
|
||||
Reference in New Issue
Block a user