From e33e0558f5333f40ba1e3ea8a1db5baab2d8da63 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 15 Sep 2023 18:20:04 +0300 Subject: [PATCH] show referred_users in /settings/personal --- files/classes/user.py | 2 +- files/templates/settings/personal.html | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/files/classes/user.py b/files/classes/user.py index 2391c8026..42b4fb0ab 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -176,7 +176,7 @@ class User(Base): authorizations = relationship("ClientAuth", back_populates="user") apps = relationship("OauthApp", back_populates="author") awards = relationship("AwardRelationship", primaryjoin="User.id==AwardRelationship.user_id", back_populates="user") - referrals = relationship("User", primaryjoin="User.id==User.referred_by") + referrals = relationship("User", primaryjoin="User.id==User.referred_by", order_by="User.created_utc") designed_hats = relationship("HatDef", primaryjoin="User.id==HatDef.author_id", back_populates="author") owned_hats = relationship("Hat", back_populates="owners") hats_equipped = relationship("Hat", lazy="raise", viewonly=True) diff --git a/files/templates/settings/personal.html b/files/templates/settings/personal.html index 890a641f7..70410b8b9 100644 --- a/files/templates/settings/personal.html +++ b/files/templates/settings/personal.html @@ -308,6 +308,21 @@
Share this link with a friend. {% if v.referral_count==0 %} When they sign up, you'll get the bronze recruitment badge. Learn more.{% elif v.referral_count<10 %} When you refer 10 friends, you'll receive the silver recruitment badge. Learn more.{% elif v.referral_count<100 %} When you refer 100 friends, you'll receive the gold recruitment badge. Learn more.{% endif %}
+ {% if v.referral_count %} +
+
+ +
+ + {% for user in v.referrals %} + + + + + {% endfor %} +
{% include "user_in_table.html" %}
+
+ {% endif %}