remotes/1693045480750635534/spooky-22
fireworks88 2021-07-24 21:54:34 +02:00
parent e185e623b6
commit bc05ceda5e
1 changed files with 8 additions and 0 deletions

View File

@ -154,6 +154,11 @@ class User(Base, Stndrd, Age_times):
lazy="dynamic",
primaryjoin="User.id==SaveRelationship.user_id")
awards = relationship(
"AwardRelationship",
primaryjoin="User.id==AwardRelationship.user_id"
)
# properties defined as SQL server-side functions
referral_count = deferred(Column(Integer, server_default=FetchedValue()))
follower_count = deferred(Column(Integer, server_default=FetchedValue()))
@ -613,6 +618,9 @@ class User(Base, Stndrd, Age_times):
pic = random.randint(1, 50)
return f"/assets/images/defaultpictures/{pic}.png"
def has_award(self, kind):
return bool(len([x for x in self.awards if x.kind == kind]))
@property
def profile_url(self):
if self.has_profile and self.profileurl: