python学习

This commit is contained in:
2019-08-01 11:03:41 +08:00
parent 165f4f3ecb
commit 1548060c7f
6 changed files with 366 additions and 199 deletions

View File

@@ -1,7 +1,7 @@
# coding: utf-8
from sqlalchemy import Column, DateTime, Integer, String
from sqlalchemy.schema import FetchedValue
from application import db
from application import app,db
class Member(db.Model):
@@ -17,3 +17,17 @@ class Member(db.Model):
status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue())
updated_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
created_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
@property
def status_desc(self):
return app.config['STATUS_MAPPING'][ str( self.status ) ]
@property
def sex_desc(self):
sex_mapping = {
"0":"未知",
"1":"",
"2":""
}
return sex_mapping[str(self.sex)]