open-law/app/models/interpretation_vote.py

19 lines
605 B
Python
Raw Normal View History

2023-04-21 12:58:47 +00:00
from app import db
from app.models.utils import BaseModel
class InterpretationVote(BaseModel):
__tablename__ = "interpretation_votes"
# Foreign keys
user_id = db.Column(db.Integer, db.ForeignKey("users.id"))
interpretation_id = db.Column(db.Integer, db.ForeignKey("interpretations.id"))
2023-04-27 13:17:25 +00:00
positive = db.Column(db.Boolean, default=True)
2023-04-21 12:58:47 +00:00
# Relationships
user = db.relationship("User", viewonly=True)
interpretation = db.relationship("Interpretation", viewonly=True)
def __repr__(self):
2023-04-27 13:17:25 +00:00
return f"<{self.user} to {self.interpretation} Positive:{self.positive}>"