Last active
March 5, 2020 14:11
-
-
Save Porter97/24955727bd79ed1bd6e72c7cfe6101b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#... | |
class User(db.Model, UserMixin): | |
#... | |
@staticmethod | |
def add_self_follows(): | |
for user in User.query.all(): | |
if not user.is_following(user): | |
user.follow(user) | |
db.session.add(user) | |
db.session.commit() | |
@staticmethod | |
def add_self_collection_follows(): | |
for user in User.query.all(): | |
for collection in user.collections: | |
if not user.is_following_collection(collection): | |
user.follow_collection(collection) | |
db.session.add(user) | |
db.session.commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment