mirror of
https://github.com/solero/houdini.git
synced 2024-12-23 05:53:38 +00:00
Age property in penguin data model
This commit is contained in:
parent
7e9ccf4b9a
commit
75add84f09
@ -1,3 +1,5 @@
|
||||
from datetime import datetime
|
||||
|
||||
from houdini.data import db
|
||||
|
||||
from houdini.data.permission import PermissionCrumbsCollection
|
||||
@ -103,6 +105,10 @@ class Penguin(db.Model):
|
||||
def safe_nickname(self, language_bitmask):
|
||||
return self.nickname if self.approval & language_bitmask else "P" + str(self.id)
|
||||
|
||||
@property
|
||||
def age(self):
|
||||
return (datetime.now() - self.registration_date).days
|
||||
|
||||
@property
|
||||
def approval(self):
|
||||
return int('{}{}0{}{}{}{}'.format(self.approval_ru * 1, self.approval_de * 1, self.approval_es * 1,
|
||||
|
Loading…
Reference in New Issue
Block a user