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