forked from MarseyWorld/MarseyWorld
sdf
parent
338d5ea74e
commit
59f2463b1a
|
@ -9,5 +9,7 @@ class Exile(Base):
|
|||
sub = Column(String, ForeignKey("subs.name"), primary_key=True)
|
||||
exiler_id = Column(Integer, ForeignKey("users.id"))
|
||||
|
||||
exiler = relationship("User", primaryjoin="User.id==Exile.exiler_id", viewonly=True)
|
||||
|
||||
def __repr__(self):
|
||||
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()
|
||||
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)
|
||||
|
||||
|
|
|
@ -8,12 +8,15 @@
|
|||
<tr>
|
||||
<th style="font-weight: bold">#</th>
|
||||
<th style="font-weight: bold">Name</th>
|
||||
<th style="font-weight: bold">Exiled by</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for user in users %}
|
||||
{% for user, exile in users %}
|
||||
<tr>
|
||||
{% set exiler=exile.exiler %}
|
||||
<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:#{{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>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue