Skip to content
Snippets Groups Projects
Commit 636af5ef authored by Martin Mareš's avatar Martin Mareš
Browse files

DSN: Adminský přehled ukazuje, koho se nedoručenka týká

parent 48145ba1
Branches
No related tags found
1 merge request!138Zpracování nedoručenek
# Web: Nástroje pro správce
from flask import render_template, request
from sqlalchemy.orm import joinedload
import mo.db as db
from mo.web import app
......@@ -14,8 +15,10 @@ def admin_all_dsn():
pager.validate()
sess = db.get_session()
query = sess.query(db.EmailDSN).order_by(db.EmailDSN.arrived_at.desc())
query = (sess.query(db.EmailDSN)
.options(joinedload(db.EmailDSN.user), joinedload(db.EmailDSN.reg))
.order_by(db.EmailDSN.arrived_at.desc()))
(count, query) = pager.apply_limits(query, pagesize=20)
dsns = query.all()
return render_template('admin_dsn.html', dsns=dsns, pager=pager, count=count)
return render_template('admin_dsn.html', dsns=dsns, pager=pager, count=count, admin_list=True)
......@@ -6,6 +6,18 @@
<tr>
<th>Čas
<td>{{ dsn.arrived_at|time_and_timedelta }}
{% if admin_list %}
<tr>
<th>Pro koho
{% if dsn.user is not none %}
<td>Uživatel {{ dsn.user|user_link }}{{ dsn.user|user_flags }}
{% if dsn.user.dsn == dsn %} (primární DSN){% endif %}
{% elif dsn.reg_id is not none %}
<td>Registrace #{{dsn.reg_id}} ({{dsn.reg.type.name}})
{% else %}
<td>???
{% endif %}
{% endif %}
<tr>
<th>Kód chyby
<td>{{ dsn.status|dsn_status }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment