Skip to content

Instantly share code, notes, and snippets.

@Porter97
Created February 13, 2020 14:27
Show Gist options
  • Save Porter97/53453a72eece66f8567d58590f23e526 to your computer and use it in GitHub Desktop.
Save Porter97/53453a72eece66f8567d58590f23e526 to your computer and use it in GitHub Desktop.
#...
class Collection(db.Model):
#...
content = db.relationship('Content', backref='collection', lazy='dynamic', cascade='all, delete-orphan')
def has_content(self, url):
return self.content.filter_by(url=url).first() is not None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment