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
No related branches found
No related tags found
1 merge request!138Zpracování nedoručenek
# Web: Nástroje pro správce # Web: Nástroje pro správce
from flask import render_template, request from flask import render_template, request
from sqlalchemy.orm import joinedload
import mo.db as db import mo.db as db
from mo.web import app from mo.web import app
...@@ -14,8 +15,10 @@ def admin_all_dsn(): ...@@ -14,8 +15,10 @@ def admin_all_dsn():
pager.validate() pager.validate()
sess = db.get_session() 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) (count, query) = pager.apply_limits(query, pagesize=20)
dsns = query.all() 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 @@ ...@@ -6,6 +6,18 @@
<tr> <tr>
<th>Čas <th>Čas
<td>{{ dsn.arrived_at|time_and_timedelta }} <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> <tr>
<th>Kód chyby <th>Kód chyby
<td>{{ dsn.status|dsn_status }} <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