Merge branch 'master' of https://bitbucket.org/ctphuoc/caotek_mesavoirs
This commit is contained in:
@@ -22,14 +22,17 @@ def get_docs(request, doc_id):
|
||||
if doc_id == 0:
|
||||
query = "SELECT * FROM docs ORDER BY theme, intitule;"
|
||||
results = request.dbsession.execute(query).fetchall()
|
||||
elif doc_id == -1:
|
||||
query = "SELECT * FROM docs where theme <> 'INTERNE' ORDER BY theme, intitule;"
|
||||
results = request.dbsession.execute(query).fetchall()
|
||||
else:
|
||||
query = "SELECT * FROM docs where doc_id = :doc_id;"
|
||||
results = request.dbsession.execute(query, {'doc_id': doc_id}).first()
|
||||
return results
|
||||
|
||||
def get_docs_bytheme(request, theme):
|
||||
"""Lire les doc"""
|
||||
query = "SELECT * FROM docs WHERE theme=:theme ORDER BY intitule;"
|
||||
results = request.dbsession.execute(query, {'theme': theme}).fetchall()
|
||||
return results
|
||||
|
||||
def update_doc(request, doc_id, intitule, texte, theme):
|
||||
"""créér ou modifier le doc"""
|
||||
if doc_id == '0':
|
||||
|
||||
@@ -7,21 +7,40 @@
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
Créér une nouvelle doc</a>
|
||||
</p>
|
||||
<div class="col-md-4">
|
||||
<table class="table table-condensed table-striped table-bordered">
|
||||
<tr>
|
||||
<th>Intitule</th>
|
||||
<th>Thème</th>
|
||||
<th>Dernière mise à jour</th>
|
||||
<th>FINANCE</th>
|
||||
</tr>
|
||||
|
||||
<tr tal:repeat="ligne docs">
|
||||
<tr tal:repeat="ligne docs_finance">
|
||||
<td><a href="doc_view/${ligne.doc_id}">${ligne.intitule}</a></td>
|
||||
<td>${ligne.theme}</td>
|
||||
<td><span tal:content="ligne.modif_le.strftime('%d/%m/%Y %H:%M')" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<table class="table table-condensed table-striped table-bordered">
|
||||
<tr>
|
||||
<th>VOITURE</th>
|
||||
</tr>
|
||||
|
||||
<tr tal:repeat="ligne docs_voiture">
|
||||
<td><a href="doc_view/${ligne.doc_id}">${ligne.intitule}</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<table class="table table-condensed table-striped table-bordered">
|
||||
<tr>
|
||||
<th class=text-center"">MAISON</th>
|
||||
</tr>
|
||||
|
||||
<tr tal:repeat="ligne docs_maison">
|
||||
<td><a href="doc_view/${ligne.doc_id}">${ligne.intitule}</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
@@ -97,11 +97,15 @@ def home(request):
|
||||
def doc_list(request):
|
||||
|
||||
# lire toutes les docs
|
||||
docs = get_docs(request, 0)
|
||||
docs_finance = get_docs_bytheme(request, 'FINANCE')
|
||||
docs_maison = get_docs_bytheme(request, 'MAISON')
|
||||
docs_voiture = get_docs_bytheme(request, 'VOITURE')
|
||||
|
||||
return {
|
||||
'page_title': u"Documents",
|
||||
'docs': docs,
|
||||
'docs_finance': docs_finance,
|
||||
'docs_maison': docs_maison,
|
||||
'docs_voiture': docs_voiture,
|
||||
}
|
||||
|
||||
@view_config(route_name='doc_edit', renderer='../templates/doc_edit.pt', permission='view')
|
||||
|
||||
Reference in New Issue
Block a user