mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 15:10:27 +00:00
Fix back_populate relationships
This commit is contained in:
parent
8dd03a4d85
commit
7d153932b3
@ -5,7 +5,7 @@ class Role(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
name = db.Column(db.String(64), index=True, unique=True)
|
||||
description = db.Column(db.String(128))
|
||||
users = db.relationship('User', backref='role', lazy=True)
|
||||
users = db.relationship('User', back_populates='role', lazy=True)
|
||||
apikeys = db.relationship('ApiKey', back_populates='role', lazy=True)
|
||||
|
||||
def __init__(self, id=None, name=None, description=None):
|
||||
@ -20,4 +20,4 @@ class Role(db.Model):
|
||||
self.description = description
|
||||
|
||||
def __repr__(self):
|
||||
return '<Role {0}r>'.format(self.name)
|
||||
return '<Role {0}>'.format(self.name)
|
||||
|
@ -34,6 +34,7 @@ class User(db.Model):
|
||||
otp_secret = db.Column(db.String(16))
|
||||
confirmed = db.Column(db.SmallInteger, nullable=False, default=0)
|
||||
role_id = db.Column(db.Integer, db.ForeignKey('role.id'))
|
||||
role = db.relationship('Role', back_populates="users", lazy=True)
|
||||
accounts = None
|
||||
|
||||
def __init__(self,
|
||||
|
Loading…
Reference in New Issue
Block a user