File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 1919 Column ("role_id" , ForeignKey ("user_role.id" )),
2020)
2121
22+ def _default_date_now ():
23+ return dtime .strftime (dtime .now (), "%Y-%m-%d" ))
2224
2325class User (Base ):
2426 __tablename__ = "api_user"
2527 id = Column (Integer , primary_key = True , autoincrement = True )
2628 roles = relationship ("UserRole" , secondary = association_table )
2729 api_key = Column (String (50 ), unique = True , nullable = False )
2830 email = Column (String (320 ), unique = True , nullable = False )
29- created = Column (Date , default = dtime . strftime ( dtime . now (), "%Y-%m-%d" ) )
30- last_time_used = Column (Date , default = dtime . strftime ( dtime . now (), "%Y-%m-%d" ) )
31+ created = Column (Date , default = _default_date_now )
32+ last_time_used = Column (Date , default = _default_date_now )
3133
3234 def __init__ (self , api_key : str , email : str = None ) -> None :
3335 self .api_key = api_key
You can’t perform that action at this time.
0 commit comments