Update for public https://habr.com/post/421887/
This commit is contained in:
@@ -5,21 +5,37 @@ __author__ = 'RemiZOffAlex'
|
||||
__copyright__ = '(c) RemiZOffAlex'
|
||||
__license__ = 'MIT'
|
||||
__email__ = 'remizoffalex@mail.ru'
|
||||
__url__ = 'http://remizoffalex.ru'
|
||||
|
||||
import datetime
|
||||
from sqlalchemy import Table, Column, Boolean, Integer, ForeignKey, String, DateTime
|
||||
from sqlalchemy import (
|
||||
Table,
|
||||
Column,
|
||||
Boolean,
|
||||
Integer,
|
||||
ForeignKey,
|
||||
String,
|
||||
DateTime
|
||||
)
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from . import Base
|
||||
|
||||
|
||||
class User(Base):
|
||||
__tablename__ = "user"
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
name = Column(String, nullable=False, unique=True)
|
||||
password = Column(String, nullable=False)
|
||||
disabled = Column(Boolean, default=True)
|
||||
created = Column(DateTime)
|
||||
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
self.created = datetime.datetime.utcnow()
|
||||
|
||||
def as_dict(self):
|
||||
return {c.name: getattr(self, c.name)
|
||||
for c in self.__table__.columns
|
||||
if c.name!='password'}
|
||||
|
||||
Reference in New Issue
Block a user