A mixin can add specific fields to another model in Flask,
Example model# User Class class User(db.Model): __tablename__ = 'User' id = db.Column(Integer, primary_key=True) username = db.Column(String(32), unique=True) email = db.Column(String(32), unique=True) password = db.Column(Binary) role = db.Column(String(32), default="Member") # Define the relationship to Role via UserRoles def __init__(self, **kwargs): for property, value in kwargs.items(): # depending on whether value is an iterable or not, we must # unpack it's value (when **kwargs is request.form, some values [...]
I have learned and forgotten regex about 30 times now. The following are my notes while I learn again so I can refer back to it.Basic Regex Matching
To match a string you can just type in the actual string you want to match so to match
Cat you can just type in cat as the regex and it will match
\d matches any digit from 1 to 9. the preceding slash is the escape symbol in regex
The . is a wildcard and matches anything including whitespace so to match three chars and a 4th char which is a full stop ie “htb.” you can use …\. escaping the last one. this matches any three characters and then a .
inside square brackets you can match [...]