Compare commits

...

2 Commits

2 changed files with 10 additions and 4 deletions

View File

@ -14,9 +14,9 @@ class User(UserMixin, db.Model):
email = db.Column(db.String(120), index=True, unique=True)
profile_pic = db.Column(db.String(256))
password_hash = db.Column(db.String(128))
google_token = db.relationship('GoogleToken', uselist=False, backref = 'user')
calendars = db.relationship('Calendar', backref='user', lazy=True)
devices = db.relationship('Device', backref='user')
google_token = db.relationship('GoogleToken', uselist=False, backref = 'user', cascade="all, delete-orphan")
calendars = db.relationship('Calendar', backref='user', lazy=True, cascade="all, delete-orphan")
devices = db.relationship('Device', backref='user', cascade="all, delete-orphan")
def __repr__(self):
return '<User {}>'.format(self.username)

View File

@ -107,7 +107,13 @@ def deleteAccount():
return redirect(url_for('account'))
# TODO fix google delete account
google.deleteAccount(current_user)
'''
for cal in current_user.calendars:
db.session.delete(cal)
for dev in current_user.devices:
db.session.delete(dev)
db.session.delete(current_user.google_token)
'''
db.session.delete(current_user)
db.session.commit()
logout_user()