mirror of https://github.com/logos-co/open-law.git
refactor Section fields
This commit is contained in:
parent
9109ab3283
commit
e3cfda9fff
|
@ -6,15 +6,19 @@ class Section(BaseModel):
|
||||||
__tablename__ = "sections"
|
__tablename__ = "sections"
|
||||||
|
|
||||||
label = db.Column(db.String(1024), unique=False, nullable=False)
|
label = db.Column(db.String(1024), unique=False, nullable=False)
|
||||||
about = db.Column(db.Text, unique=False, nullable=False)
|
about = db.Column(db.Text, unique=False, nullable=True)
|
||||||
|
|
||||||
# Foreign keys
|
# Foreign keys
|
||||||
collection_id = db.Column(db.ForeignKey("collections.id"))
|
collection_id = db.Column(db.ForeignKey("collections.id"))
|
||||||
user_id = db.Column(db.ForeignKey("users.id"))
|
user_id = db.Column(db.ForeignKey("users.id"))
|
||||||
|
version_id = db.Column(db.ForeignKey("book_versions.id"))
|
||||||
|
selected_interpretation_id = db.Column(db.Integer, nullable=True)
|
||||||
|
|
||||||
# Relationships
|
# Relationships
|
||||||
collection = db.relationship("Collection", viewonly=True)
|
collection = db.relationship("Collection", viewonly=True)
|
||||||
user = db.relationship("User")
|
user = db.relationship("User", viewonly=True)
|
||||||
|
version = db.relationship("BookVersion", viewonly=True)
|
||||||
|
interpretations = db.relationship("Interpretation", viewonly=True)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<{self.id}: {self.label}>"
|
return f"<{self.id}: {self.label}>"
|
||||||
|
|
Loading…
Reference in New Issue