sdf
This commit is contained in:
parent
f162788748
commit
613f321d7b
3 changed files with 7 additions and 2 deletions
|
@ -9,5 +9,7 @@ class Exile(Base):
|
||||||
sub = Column(String, ForeignKey("subs.name"), primary_key=True)
|
sub = Column(String, ForeignKey("subs.name"), primary_key=True)
|
||||||
exiler_id = Column(Integer, ForeignKey("users.id"))
|
exiler_id = Column(Integer, ForeignKey("users.id"))
|
||||||
|
|
||||||
|
exiler = relationship("User", primaryjoin="User.id==Exile.exiler_id", viewonly=True)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<Exile(user_id={self.user_id}, sub={self.sub})>"
|
return f"<Exile(user_id={self.user_id}, sub={self.sub})>"
|
|
@ -173,7 +173,7 @@ def exilees(v, sub):
|
||||||
sub = g.db.query(Sub).filter_by(name=sub.strip().lower()).one_or_none()
|
sub = g.db.query(Sub).filter_by(name=sub.strip().lower()).one_or_none()
|
||||||
if not sub: abort(404)
|
if not sub: abort(404)
|
||||||
|
|
||||||
users = g.db.query(User).join(Exile, Exile.user_id==User.id).filter_by(sub=sub.name).all()
|
users = g.db.query(User, Exile).join(Exile, Exile.user_id==User.id).filter_by(sub=sub.name).all()
|
||||||
|
|
||||||
return render_template("sub/exilees.html", v=v, sub=sub, users=users)
|
return render_template("sub/exilees.html", v=v, sub=sub, users=users)
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,15 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th style="font-weight: bold">#</th>
|
<th style="font-weight: bold">#</th>
|
||||||
<th style="font-weight: bold">Name</th>
|
<th style="font-weight: bold">Name</th>
|
||||||
|
<th style="font-weight: bold">Exiled by</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for user in users %}
|
{% for user, exile in users %}
|
||||||
<tr>
|
<tr>
|
||||||
|
{% set exiler=exile.exiler %}
|
||||||
<td style="font-weight: bold">{{loop.index}}</td>
|
<td style="font-weight: bold">{{loop.index}}</td>
|
||||||
<td><a style="color:#{{user.namecolor}}; font-weight:bold;" href="/@{{user.username}}"><img alt="@{{user.username}}'s profile picture" loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.namecolor}}"{% endif %}>{{user.username}}</span></a></td>
|
<td><a style="color:#{{user.namecolor}}; font-weight:bold;" href="/@{{user.username}}"><img alt="@{{user.username}}'s profile picture" loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.namecolor}}"{% endif %}>{{user.username}}</span></a></td>
|
||||||
|
<td><a style="color:#{{exiler.namecolor}}; font-weight:bold;" href="/@{{exiler.username}}"><img alt="@{{exiler.username}}'s profile picture" loading="lazy" src="{{exiler.profile_url}}" class="pp20"><span {% if exiler.patron %}class="patron" style="background-color:#{{exiler.namecolor}}"{% endif %}>{{exiler.username}}</span></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue