Merge branch 'master' of https://github.com/Aevann1/Drama
This commit is contained in:
commit
4e29867c61
1 changed files with 8 additions and 0 deletions
|
@ -155,6 +155,11 @@ class User(Base, Stndrd, Age_times):
|
||||||
lazy="dynamic",
|
lazy="dynamic",
|
||||||
primaryjoin="User.id==SaveRelationship.user_id")
|
primaryjoin="User.id==SaveRelationship.user_id")
|
||||||
|
|
||||||
|
awards = relationship(
|
||||||
|
"AwardRelationship",
|
||||||
|
primaryjoin="User.id==AwardRelationship.user_id"
|
||||||
|
)
|
||||||
|
|
||||||
# properties defined as SQL server-side functions
|
# properties defined as SQL server-side functions
|
||||||
referral_count = deferred(Column(Integer, server_default=FetchedValue()))
|
referral_count = deferred(Column(Integer, server_default=FetchedValue()))
|
||||||
follower_count = deferred(Column(Integer, server_default=FetchedValue()))
|
follower_count = deferred(Column(Integer, server_default=FetchedValue()))
|
||||||
|
@ -614,6 +619,9 @@ class User(Base, Stndrd, Age_times):
|
||||||
pic = random.randint(1, 50)
|
pic = random.randint(1, 50)
|
||||||
return f"/assets/images/defaultpictures/{pic}.png"
|
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
|
@property
|
||||||
def profile_url(self):
|
def profile_url(self):
|
||||||
if self.has_profile and self.profileurl:
|
if self.has_profile and self.profileurl:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue