MCPcopy Index your code
hub / github.com/realpython/discover-flask / User

Class User

project/models.py:26–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25
26class User(db.Model):
27
28 __tablename__ = "users"
29
30 id = db.Column(db.Integer, primary_key=True)
31 name = db.Column(db.String, nullable=False)
32 email = db.Column(db.String, nullable=False)
33 password = db.Column(db.String)
34 posts = relationship("BlogPost", backref="author")
35
36 def __init__(self, name, email, password):
37 self.name = name
38 self.email = email
39 self.password = bcrypt.generate_password_hash(password)
40
41 def is_authenticated(self):
42 return True
43
44 def is_active(self):
45 return True
46
47 def is_anonymous(self):
48 return False
49
50 def get_id(self):
51 return unicode(self.id)
52
53 def __repr__(self):
54 return '<name - {}>'.format(self.name)

Callers 3

db_create_users.pyFile · 0.90
registerFunction · 0.90
setUpMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected