Compare commits
6 Commits
ff9d226c9e
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b686b9e27 | |||
| 7f0307ec00 | |||
| 3b3361d329 | |||
| 9c663daefc | |||
| cfa58e0859 | |||
| da6216e92b |
@@ -140,6 +140,10 @@ def delete_topic(request, topic):
|
||||
execute_query(request, query, {'topic': topic})
|
||||
|
||||
def update_entry(request, blog_id, new_values):
|
||||
# si le title a changé, modifier le title_url en urlify le nouveau titre
|
||||
if 'title' in new_values:
|
||||
new_values['title_url'] = urlify(new_values['title'].replace("'","-"))
|
||||
|
||||
# formater les champs
|
||||
s = ''
|
||||
for param in new_values.keys():
|
||||
@@ -150,14 +154,15 @@ def update_entry(request, blog_id, new_values):
|
||||
|
||||
# import pdb;pdb.set_trace()
|
||||
if blog_id == '0':
|
||||
query = """INSERT INTO entries (title, body, created, edited, topic_id, tag, author, status, creator, editor)
|
||||
VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{8}')""".format(
|
||||
query = """INSERT INTO entries (title, body, created, edited, topic_id, tag, author, status, creator, editor, title_url)
|
||||
VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}')""".format(
|
||||
new_values['title'].replace("'","''"), new_values['body'].replace("'","''"), new_values['created'], new_values['created'],
|
||||
new_values['topic_id'], new_values['tag'], new_values['author'], new_values['status'],
|
||||
new_values['editor'], new_values['editor'],)
|
||||
new_values['editor'], new_values['editor'], urlify(new_values['title'].replace("'","-")))
|
||||
else:
|
||||
new_values['id'] = blog_id
|
||||
query = "UPDATE entries SET %s WHERE id = :id;" % s
|
||||
|
||||
execute_query(request, query, new_values)
|
||||
|
||||
def update_tag(request, id, new_values):
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.9 MiB |
+2
-4
@@ -83,7 +83,7 @@
|
||||
--bs-body-font-size: 0.875rem;
|
||||
--bs-body-font-weight: 400;
|
||||
--bs-body-line-height: 1.5;
|
||||
--bs-body-color: #768b9e;
|
||||
--bs-body-color: #232324;
|
||||
--bs-body-color-rgb: 118, 139, 158;
|
||||
--bs-body-bg: #fff;
|
||||
--bs-body-bg-rgb: 255, 255, 255;
|
||||
@@ -97,7 +97,7 @@
|
||||
--bs-tertiary-color-rgb: 118, 139, 158;
|
||||
--bs-tertiary-bg: #f6f8fa;
|
||||
--bs-tertiary-bg-rgb: 246, 248, 250;
|
||||
--bs-heading-color: #3a4752;
|
||||
--bs-heading-color: #df4937;
|
||||
--bs-link-color: #0d6efd;
|
||||
--bs-link-color-rgb: 41, 82, 255;
|
||||
--bs-link-decoration: underline;
|
||||
@@ -227,7 +227,6 @@ h6, .h6, h5, .h5, h4, .h4, h3, .h3, h2, .h2, h1, .h1 {
|
||||
|
||||
h1, .h1 {
|
||||
font-size: calc(1.34375rem + 1.125vw);
|
||||
color: #df4937
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h1, .h1 {
|
||||
@@ -255,7 +254,6 @@ h3, .h3 {
|
||||
|
||||
h4, .h4 {
|
||||
font-size: calc(1.25625rem + 0.075vw);
|
||||
color: #df4937
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h4, .h4 {
|
||||
|
||||
@@ -248,6 +248,15 @@
|
||||
<span class="hide-menu">Contactez nous - Liên hệ</span>
|
||||
</a>
|
||||
</p>
|
||||
{% if request.authenticated_userid %}
|
||||
<p class="mb-0 fs-4">
|
||||
<a class="sidebar-link" href="https://www.ovhcloud.com/fr/mail/" aria-expanded="false">
|
||||
<span class="hide-menu">SUNYATA Paris webmail</span>
|
||||
</a><br>
|
||||
Zoom claim host key : 310069
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
{% block content %}
|
||||
|
||||
<div class="card mb-0">
|
||||
<div class="card-body">
|
||||
<p class="text-danger">
|
||||
Attention ! Les traitements ci-dessous modifient la base de données de manière irréversible. A lancer avec une extrême prudence.
|
||||
</p>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form id="search-form" class="form-horizontal" role="form" action="/maintenance" method="post">
|
||||
|
||||
|
||||
@@ -39,14 +39,12 @@
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.client_addr == '127.0.0.1' %}
|
||||
<li class="sidebar-item mb-3">
|
||||
<a class="sidebar-link" href=" {{request.route_url('maintenance') }} " aria-expanded="false">
|
||||
<span><i class="ti ti-server fs-6"></i></span>
|
||||
<span class="hide-menu">Maintenance BD</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@@ -28,9 +28,7 @@
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label required-field" for="topic_quote">Citation</label>
|
||||
<textarea class="form-control monospace-font" id="topic_quote" name="topic_quote" required rows="10" cols="35">
|
||||
{{ entry.topic_quote }}
|
||||
</textarea>
|
||||
<textarea class="form-control monospace-font" id="topic_quote" name="topic_quote" required rows="10" cols="35">{{ entry.topic_quote }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
|
||||
@@ -6,7 +6,6 @@ import markdown
|
||||
import datetime #<- will be used to set default dates on models
|
||||
|
||||
from ..models.entries import *
|
||||
from webhelpers2.text import urlify #<- will generate slugs
|
||||
from webhelpers2.date import distance_of_time_in_words #<- human friendly dates
|
||||
from urllib.parse import urlparse
|
||||
|
||||
@@ -131,13 +130,13 @@ def blog_edit(request):
|
||||
|
||||
if 'form.submitted' in request.params:
|
||||
new_values = {}
|
||||
# import pdb; pdb.set_trace()
|
||||
for param in entry.keys():
|
||||
if param in request.params and request.params[param] != entry[param]:
|
||||
new_values[param] = request.params[param]
|
||||
if param == 'title':
|
||||
# interdire le car '/' dans le titre à cause du slug
|
||||
new_values['title'] = new_values['title'].replace('/','.')
|
||||
new_values['title_url'] = urlify(new_values['title'].replace("'","-"))
|
||||
elif param == 'body':
|
||||
new_values['body'] = new_values['body'].strip()
|
||||
elif param == 'source_link':
|
||||
@@ -164,6 +163,9 @@ def blog_edit(request):
|
||||
new_values['editor'] = request.authenticated_userid
|
||||
new_values['edited'] = datetime.datetime.now()
|
||||
update_entry(request, blog_id, new_values)
|
||||
request.session.flash("La page a été modifiée avec succès.", 'success')
|
||||
|
||||
# retour
|
||||
return HTTPFound(location=url_retour)
|
||||
|
||||
if 'form.deleted' in request.params:
|
||||
|
||||
Reference in New Issue
Block a user