added recon method
This commit is contained in:
@@ -15,12 +15,12 @@ Requires-Dist: pyramid
|
||||
Requires-Dist: pyramid_jinja2
|
||||
Requires-Dist: pyramid_debugtoolbar
|
||||
Requires-Dist: waitress
|
||||
Requires-Dist: alembic
|
||||
Requires-Dist: alembic==1.4.2
|
||||
Requires-Dist: pyramid_retry
|
||||
Requires-Dist: pyramid_layout
|
||||
Requires-Dist: pyramid_tm
|
||||
Requires-Dist: python-magic
|
||||
Requires-Dist: SQLAlchemy
|
||||
Requires-Dist: SQLAlchemy==1.4.49
|
||||
Requires-Dist: transaction
|
||||
Requires-Dist: zope.sqlalchemy
|
||||
Requires-Dist: wtforms
|
||||
|
||||
@@ -3,12 +3,12 @@ pyramid
|
||||
pyramid_jinja2
|
||||
pyramid_debugtoolbar
|
||||
waitress
|
||||
alembic
|
||||
alembic==1.4.2
|
||||
pyramid_retry
|
||||
pyramid_layout
|
||||
pyramid_tm
|
||||
python-magic
|
||||
SQLAlchemy
|
||||
SQLAlchemy==1.4.49
|
||||
transaction
|
||||
zope.sqlalchemy
|
||||
wtforms
|
||||
|
||||
BIN
cao_osint.sqlite
BIN
cao_osint.sqlite
Binary file not shown.
@@ -25,13 +25,13 @@ class BlogRecordService(object):
|
||||
return query.get(_id)
|
||||
|
||||
@classmethod
|
||||
def get_last_created(cls, request):
|
||||
# gest the 10 last created posts
|
||||
def get_last_edited(cls, request):
|
||||
# gest the 10 last edited posts
|
||||
query = request.dbsession.query(BlogRecord)
|
||||
if request.authenticated_userid == None:
|
||||
# if user is anonym, display only published posts
|
||||
query = query.filter(BlogRecord.status == 'publié')
|
||||
query = query.order_by(sa.desc(BlogRecord.created)).limit(10).all()
|
||||
query = query.order_by(sa.desc(BlogRecord.edited)).limit(10).all()
|
||||
return query
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -83,7 +83,7 @@ h3, h4 {
|
||||
.navbar {
|
||||
font-family: Montserrat, sans-serif;
|
||||
margin-bottom: 0;
|
||||
background-color: #bc2131;
|
||||
background-color: #2F4F4F;
|
||||
border: 0;
|
||||
font-size: 14px !important;
|
||||
letter-spacing: 4px;
|
||||
@@ -103,7 +103,7 @@ h3, h4 {
|
||||
border-color: transparent;
|
||||
}
|
||||
footer {
|
||||
background-color: #bc2131;
|
||||
background-color: #2F4F4F;
|
||||
color: #f5f5f5;
|
||||
padding: 32px;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<table id="posts_list" class="table table-condensed">
|
||||
{% for entry in last_ten %}
|
||||
<tr>
|
||||
<td>{{ entry.created.strftime("%d.%m.%Y") }}</td>
|
||||
<td>{{ entry.edited.strftime("%d.%m.%Y") }}</td>
|
||||
<td>
|
||||
<a href="{{ request.route_url('blog', id=entry.id, slug=entry.slug) }}">{{ entry.title }}</a>
|
||||
</td>
|
||||
@@ -27,28 +27,6 @@
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<!-- formulaire de recherche -->
|
||||
<hr>
|
||||
<br>
|
||||
<br>
|
||||
<div class="well">
|
||||
|
||||
<form id="search-form" role="form" action="/blog_search" method="post">
|
||||
<div class="form-group">
|
||||
<label for="criteria">{{ form.criteria.label }}</label>
|
||||
<div class="input-group">
|
||||
{{ form.criteria(class_='form-control') }}
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary" type="submit" name="form.submitted">
|
||||
Rechercher
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
{% for error in form.criteria.errors %}
|
||||
<div class="text-danger">{{ error }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -16,16 +16,12 @@ import magic
|
||||
@view_config(route_name='home', renderer='../templates/home.jinja2', permission='view')
|
||||
def home(request):
|
||||
# get the last created posts
|
||||
last_ten = BlogRecordService.get_last_created(request)
|
||||
last_ten = BlogRecordService.get_last_edited(request)
|
||||
|
||||
criteria = ''
|
||||
form = BlogSearchForm(request.POST)
|
||||
|
||||
return {
|
||||
'page_title': "",
|
||||
'last_ten': last_ten,
|
||||
'form': form,
|
||||
'criteria': criteria,
|
||||
}
|
||||
|
||||
|
||||
|
||||
4
setup.py
4
setup.py
@@ -14,12 +14,12 @@ requires = [
|
||||
'pyramid_jinja2',
|
||||
'pyramid_debugtoolbar',
|
||||
'waitress',
|
||||
'alembic',
|
||||
'alembic==1.4.2',
|
||||
'pyramid_retry',
|
||||
'pyramid_layout',
|
||||
'pyramid_tm',
|
||||
'python-magic',
|
||||
'SQLAlchemy',
|
||||
'SQLAlchemy==1.4.49',
|
||||
'transaction',
|
||||
'zope.sqlalchemy',
|
||||
'wtforms', # form library 2.2.1
|
||||
|
||||
Reference in New Issue
Block a user