refonte des topics
This commit is contained in:
@@ -10,7 +10,7 @@ class BlogCreateForm(Form):
|
|||||||
filters=[strip_filter])
|
filters=[strip_filter])
|
||||||
body = TextAreaField('Corps du texte', validators=[InputRequired(), Length(min=1)],
|
body = TextAreaField('Corps du texte', validators=[InputRequired(), Length(min=1)],
|
||||||
filters=[strip_filter])
|
filters=[strip_filter])
|
||||||
tag = SelectField('Sous-rubrique')
|
tag = SelectField('Tag')
|
||||||
author = StringField('Auteur', validators=[InputRequired(), Length(min=1, max=50)],
|
author = StringField('Auteur', validators=[InputRequired(), Length(min=1, max=50)],
|
||||||
filters=[strip_filter])
|
filters=[strip_filter])
|
||||||
status = SelectField('Statut', choices=[('brouillon','Brouillon'),('publié','Publié')])
|
status = SelectField('Statut', choices=[('brouillon','Brouillon'),('publié','Publié')])
|
||||||
@@ -29,7 +29,7 @@ class UserCreateForm(Form):
|
|||||||
password = PasswordField('Mot de passe', validators=[InputRequired(), Length(min=6)])
|
password = PasswordField('Mot de passe', validators=[InputRequired(), Length(min=6)])
|
||||||
|
|
||||||
class TopicForm(Form):
|
class TopicForm(Form):
|
||||||
topic = StringField('Rubrique', validators=[InputRequired(), Length(min=1, max=25)],
|
topic = StringField('Topic', validators=[InputRequired(), Length(min=1, max=25)],
|
||||||
filters=[strip_filter])
|
filters=[strip_filter])
|
||||||
topic_name = StringField('Intitulé', validators=[InputRequired(), Length(min=1, max=25)],
|
topic_name = StringField('Intitulé', validators=[InputRequired(), Length(min=1, max=25)],
|
||||||
filters=[strip_filter])
|
filters=[strip_filter])
|
||||||
@@ -40,7 +40,7 @@ class TopicForm(Form):
|
|||||||
class TagForm(Form):
|
class TagForm(Form):
|
||||||
id = IntegerField(widget=HiddenInput())
|
id = IntegerField(widget=HiddenInput())
|
||||||
|
|
||||||
tag = StringField('Sous-rubrique', validators=[InputRequired(), Length(min=1, max=25)],
|
tag = StringField('Tag', validators=[InputRequired(), Length(min=1, max=25)],
|
||||||
filters=[strip_filter])
|
filters=[strip_filter])
|
||||||
tag_name = StringField('Intitulé', validators=[InputRequired(), Length(min=1, max=25)],
|
tag_name = StringField('Intitulé', validators=[InputRequired(), Length(min=1, max=25)],
|
||||||
filters=[strip_filter])
|
filters=[strip_filter])
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class BlogRecordService(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_last_created(cls, request):
|
def get_last_created(cls, request):
|
||||||
# gest the last created posts
|
# gest the last created posts
|
||||||
query = request.dbsession.query(BlogRecord).filter(BlogRecord.topic_id != 'ADM')
|
query = request.dbsession.query(BlogRecord).filter(BlogRecord.topic_id != '_admin')
|
||||||
if request.authenticated_userid == None:
|
if request.authenticated_userid == None:
|
||||||
# if user is anonym, display only published posts
|
# if user is anonym, display only published posts
|
||||||
query = query.filter(BlogRecord.status == 'publié')
|
query = query.filter(BlogRecord.status == 'publié')
|
||||||
@@ -49,7 +49,7 @@ class BlogRecordService(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_activities(cls, request):
|
def get_activities(cls, request):
|
||||||
# gest the Activities section
|
# gest the Activities section
|
||||||
query = request.dbsession.query(BlogRecord).filter(and_(BlogRecord.topic_id == 'ADM',
|
query = request.dbsession.query(BlogRecord).filter(and_(BlogRecord.topic_id == '_admin',
|
||||||
BlogRecord.tag == 'activities',
|
BlogRecord.tag == 'activities',
|
||||||
BlogRecord.status == 'publié'))
|
BlogRecord.status == 'publié'))
|
||||||
query = query.order_by(sa.desc(BlogRecord.created)).first()
|
query = query.order_by(sa.desc(BlogRecord.created)).first()
|
||||||
@@ -77,7 +77,7 @@ class BlogRecordService(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_topics(cls, request):
|
def get_topics(cls, request):
|
||||||
# get all topics
|
# get all topics
|
||||||
query = request.dbsession.query(Topics).order_by(Topics.topic).all()
|
query = request.dbsession.query(Topics).order_by(Topics.topic_name).all()
|
||||||
return query
|
return query
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
Auteur : <strong>{{ entry.author }}</strong><br>
|
Auteur : <strong>{{ entry.author }}</strong><br>
|
||||||
Publié le : <strong>{{ entry.created.strftime("%d-%m-%Y - %H:%M") }}</strong><br>
|
Publié le : <strong>{{ entry.created.strftime("%d-%m-%Y - %H:%M") }}</strong><br>
|
||||||
{% if request.authenticated_userid %}
|
{% if request.authenticated_userid %}
|
||||||
Topic - Tag : <strong>{{ entry.topic_id }}</strong> - <strong>{{ entry.tag }}</strong>
|
Topic - Tag : <strong>{{ entry.topic_id }}</strong> - <strong>{{ entry.tag }}</strong><br>
|
||||||
|
Statut : <strong>{{ entry.status }}</strong>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -145,8 +145,8 @@
|
|||||||
116 bd Maréchal Foch<br>
|
116 bd Maréchal Foch<br>
|
||||||
93160 NOISY LE GRAND<br>
|
93160 NOISY LE GRAND<br>
|
||||||
<br>
|
<br>
|
||||||
station Bry sur Marne <span class="label label-danger">RER A</span><br>
|
<span class="label label-danger">RER A</span> station Bry sur Marne<br>
|
||||||
arrêt Verdun <span class="label label-primary">Bus 220</span><br>
|
<span class="label label-primary">Bus 220</span> arrêt Verdun<br>
|
||||||
<br>
|
<br>
|
||||||
<span class="glyphicon glyphicon-envelope"></span><br>
|
<span class="glyphicon glyphicon-envelope"></span><br>
|
||||||
contact@meditation-sunyata.paris
|
contact@meditation-sunyata.paris
|
||||||
|
|||||||
@@ -54,30 +54,30 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<span class="menu-item">
|
<span class="menu-item">
|
||||||
<a href="{{ request.route_url('topic', topic='FR1') }}">ENSEIGNEMENT</a>
|
<a href="{{ request.route_url('topic', topic='enseignement') }}">ENSEIGNEMENT</a>
|
||||||
</span>
|
</span>
|
||||||
<span class="menu-item">
|
<span class="menu-item">
|
||||||
<a href="{{ request.route_url('topic', topic='FR2') }}">PRATIQUE</a>
|
<a href="{{ request.route_url('topic', topic='pratique') }}">PRATIQUE</a>
|
||||||
</span>
|
</span>
|
||||||
<span class="menu-item">
|
<span class="menu-item">
|
||||||
<a href="{{ request.route_url('topic', topic='FR3') }}">QI GONG</a>
|
<a href="{{ request.route_url('topic', topic='qigong') }}">QI GONG</a>
|
||||||
</span>
|
</span>
|
||||||
<span class="menu-item">
|
<span class="menu-item">
|
||||||
<a href="{{ request.route_url('topic', topic='FR4') }}">SCIENCES</a>
|
<a href="{{ request.route_url('topic', topic='sciences') }}">SCIENCES</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<span class="menu-item">
|
<span class="menu-item">
|
||||||
<a href="{{ request.route_url('topic', topic='VN1') }}">TU HỌC</a>
|
<a href="{{ request.route_url('topic', topic='tu_hoc') }}">TU HỌC</a>
|
||||||
</span>
|
</span>
|
||||||
<span class="menu-item">
|
<span class="menu-item">
|
||||||
<a href="{{ request.route_url('topic', topic='VN2') }}">TU TẬP</a>
|
<a href="{{ request.route_url('topic', topic='tu_tap') }}">TU TẬP</a>
|
||||||
</span>
|
</span>
|
||||||
<span class="menu-item">
|
<span class="menu-item">
|
||||||
<a href="{{ request.route_url('topic', topic='FR3') }}">KHÍ CÔNG</a>
|
<a href="{{ request.route_url('topic', topic='qigong') }}">KHÍ CÔNG</a>
|
||||||
</span>
|
</span>
|
||||||
<span class="menu-item">
|
<span class="menu-item">
|
||||||
<a href="{{ request.route_url('topic', topic='VN4') }}">KHOA HỌC</a>
|
<a href="{{ request.route_url('topic', topic='sciences') }}">KHOA HỌC</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
© 2022 - Méditation SUNYATA Paris
|
© 2022 - Méditation SUNYATA Paris
|
||||||
| <a href="{{ request.route_url('blog', id=1, slug='mentions-legales') }}">Mentions légales</a>
|
| <a href="{{ request.route_url('blog', id=1, slug='mentions-legales') }}">Mentions légales</a>
|
||||||
| <a href="{{ request.route_url('topic', topic='FR9') }}">A propos</a>
|
| <a href="{{ request.route_url('topic', topic='apropos') }}">A propos</a>
|
||||||
| <a href="https://www.ovhcloud.com/fr/mail/" target="__blank">Contact</a>
|
| <a href="https://www.ovhcloud.com/fr/mail/" target="__blank">Contact</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -56,13 +56,13 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h2>Informations</h2>
|
<h2>Informations système</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Client addr : {{ request.client_addr }}</li>
|
<li>Pyramid {{ pyramid_version }}</li>
|
||||||
<li>Remote addr : {{ request.remote_addr }}</li>
|
<li>WTForms {{ wtforms_version }}</li>
|
||||||
<li>Remote host : {{ request.remote_host }}</li>
|
<li>SQLAlchemy {{ sqlalchemy_version }}</li>
|
||||||
<li>Remote port : {{ request.remote_port }}</li>
|
<li>SQLite {{ sqlite_version }}</li>
|
||||||
<li>Server name : {{ request.server_name }}</li>
|
<li>Python {{ python_version }}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -42,11 +42,11 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
<h4 class="modal-title">Supprimer la sous-rubrique</h4>
|
<h4 class="modal-title">Supprimer le Tag</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<!-- The form is placed inside the body of modal -->
|
<!-- The form is placed inside the body of modal -->
|
||||||
<p>Etes-vous certain(e) de vouloir supprimer la sous-rubrique <b>{{ form.tag_name.data }}</b> ?</p>
|
<p>Etes-vous certain(e) de vouloir supprimer le Tag <b>{{ form.tag_name.data }}</b> ?</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h3>Sous-rubriques</h3>
|
<h3>Liste des Tags</h3>
|
||||||
<p><a href="{{ request.route_url('tag_edit', topic=form.topic.data, id='0') }}" class="btn btn-success" role="button">
|
<p><a href="{{ request.route_url('tag_edit', topic=form.topic.data, id='0') }}" class="btn btn-success" role="button">
|
||||||
<span class="glyphicon glyphicon-plus"></span> Nouveau</a>
|
<span class="glyphicon glyphicon-plus"></span> Nouveau</a>
|
||||||
</p>
|
</p>
|
||||||
@@ -52,8 +52,8 @@
|
|||||||
<table id="users_list" class="table table-striped table-bordered table-condensed">
|
<table id="users_list" class="table table-striped table-bordered table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Sous-rubrique</th>
|
<th>Tag</th>
|
||||||
<th>Intitulé</th>
|
<th>Nom du tag</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for entry in tags %}
|
{% for entry in tags %}
|
||||||
@@ -74,11 +74,11 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
<h4 class="modal-title">Supprimer la rubrique</h4>
|
<h4 class="modal-title">Supprimer le Topic</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<!-- The form is placed inside the body of modal -->
|
<!-- The form is placed inside the body of modal -->
|
||||||
<p>Etes-vous certain(e) de vouloir supprimer la rubrique <b>{{ form.topic_name.data }}</b> ?</p>
|
<p>Etes-vous certain(e) de vouloir supprimer le Topic <b>{{ form.topic_name.data }}</b> ?</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@@ -5,14 +5,14 @@
|
|||||||
<a href="{{ request.route_url('settings') }}" class="btn btn-default" role="button">
|
<a href="{{ request.route_url('settings') }}" class="btn btn-default" role="button">
|
||||||
<span class="glyphicon glyphicon-chevron-left"></span> Retour</a>
|
<span class="glyphicon glyphicon-chevron-left"></span> Retour</a>
|
||||||
<a href="{{ request.route_url('topic_edit', topic='0') }}" class="btn btn-success" role="button">
|
<a href="{{ request.route_url('topic_edit', topic='0') }}" class="btn btn-success" role="button">
|
||||||
<span class="glyphicon glyphicon-plus"></span> Nouvelle rubrique</a>
|
<span class="glyphicon glyphicon-plus"></span> Nouveau Topic</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<table id="users_list" class="table table-striped table-condensed">
|
<table id="users_list" class="table table-striped table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Rubrique</th>
|
<th>Topic</th>
|
||||||
<th>Nom</th>
|
<th>Name</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for entry in topics %}
|
{% for entry in topics %}
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ import shutil
|
|||||||
import magic
|
import magic
|
||||||
import json
|
import json
|
||||||
from urllib import request, parse
|
from urllib import request, parse
|
||||||
|
import pkg_resources
|
||||||
|
import sys
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
@view_config(route_name='home',
|
@view_config(route_name='home',
|
||||||
renderer='cao_blogr:templates/home.jinja2')
|
renderer='cao_blogr:templates/home.jinja2')
|
||||||
@@ -113,13 +115,25 @@ def captcha_validate(response, remote_addr, secret):
|
|||||||
def settings(request):
|
def settings(request):
|
||||||
|
|
||||||
# lire toutes les docs du topic
|
# lire toutes les docs du topic
|
||||||
topic = 'ADM'
|
topic = '_admin'
|
||||||
items = BlogRecordService.by_topic(request, topic, '')
|
items = BlogRecordService.by_topic(request, topic, '')
|
||||||
|
|
||||||
|
# informations sur les versions
|
||||||
|
pyramid_version = pkg_resources.get_distribution("pyramid").version
|
||||||
|
wtforms_version = pkg_resources.get_distribution("wtforms").version
|
||||||
|
sqlalchemy_version = pkg_resources.get_distribution("sqlalchemy").version
|
||||||
|
sqlite_version = sqlite3.sqlite_version
|
||||||
|
python_version = sys.version
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'page_title': "Paramètres",
|
'page_title': "Paramètres",
|
||||||
'topic': topic,
|
'topic': topic,
|
||||||
'items': items,
|
'items': items,
|
||||||
|
'pyramid_version': pyramid_version,
|
||||||
|
'python_version' : python_version,
|
||||||
|
'sqlite_version' : sqlite_version,
|
||||||
|
'sqlalchemy_version': sqlalchemy_version,
|
||||||
|
'wtforms_version': wtforms_version,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -218,7 +232,7 @@ def topics(request):
|
|||||||
# get all topics
|
# get all topics
|
||||||
topics = BlogRecordService.get_topics(request)
|
topics = BlogRecordService.get_topics(request)
|
||||||
return {
|
return {
|
||||||
'page_title': "Liste des rubriques",
|
'page_title': "Liste des Topics",
|
||||||
'topics': topics
|
'topics': topics
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +250,7 @@ def topic_edit(request):
|
|||||||
# create a new topic
|
# create a new topic
|
||||||
entry = Topics()
|
entry = Topics()
|
||||||
form = TopicForm(request.POST, entry)
|
form = TopicForm(request.POST, entry)
|
||||||
page_title = "Nouvelle rubrique"
|
page_title = "Nouveau Topic"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# modify post
|
# modify post
|
||||||
@@ -282,7 +296,7 @@ def tag_edit(request):
|
|||||||
# create a new tag
|
# create a new tag
|
||||||
entry = Tags()
|
entry = Tags()
|
||||||
form = TagForm(request.POST, entry)
|
form = TagForm(request.POST, entry)
|
||||||
page_title = "Nouvelle sous-rubrique"
|
page_title = "Nouveau Tag"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# modify post
|
# modify post
|
||||||
|
|||||||
Reference in New Issue
Block a user