added update created date in blog_edit
This commit is contained in:
@@ -36,12 +36,12 @@
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Topic : <strong>{{ entry.topic_id }}</strong>
|
||||
Topic : <strong>{{ entry.topic_id }}</strong><br>
|
||||
{% if blog_id != '0' %}
|
||||
|
|
||||
Créé le : <strong>{{ entry.created.strftime("%d-%m-%Y - %H:%M") }}</strong>
|
||||
|
|
||||
Modifié le : <strong>{{ entry.edited.strftime("%d-%m-%Y - %H:%M") }}</strong>
|
||||
Créé le : <strong>{{ entry.created.strftime("%d-%m-%Y - %H:%M") }}</strong>
|
||||
<button class="btn btn-link" type="submit" name="form.update_created">[ Mettre à jour ]</button>
|
||||
<br>
|
||||
Modifié le : <strong>{{ entry.edited.strftime("%d-%m-%Y - %H:%M") }}</strong>
|
||||
{% endif %}
|
||||
</p>
|
||||
<br />
|
||||
|
||||
@@ -103,6 +103,12 @@ def blog_edit(request):
|
||||
entry.editor = request.authenticated_userid
|
||||
return HTTPFound(location=request.route_url('blog', id=entry.id, slug=entry.slug))
|
||||
|
||||
if 'form.update_created' in request.params and form.validate():
|
||||
del form.id # SECURITY: prevent overwriting of primary key
|
||||
form.populate_obj(entry)
|
||||
entry.created = datetime.datetime.now()
|
||||
return HTTPFound(location=request.route_url('blog', id=entry.id, slug=entry.slug))
|
||||
|
||||
if 'form.deleted' in request.params:
|
||||
BlogRecordService.delete(request, blog_id)
|
||||
request.session.flash("La page a été supprimée avec succès.", 'success')
|
||||
|
||||
Reference in New Issue
Block a user