Skip to content

Commit

Permalink
4 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dorpivovar committed Mar 8, 2024
1 parent 5b25d18 commit 0750ee5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
41 changes: 41 additions & 0 deletions data/mini-tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import datetime

import sqlalchemy
# from werkzeug.security import generate_password_hash, check_password_hash
from .db_session import SqlAlchemyBase
from sqlalchemy import orm
from flask_login import UserMixin


class MiniTest(SqlAlchemyBase, UserMixin):
__tablename__ = 'questions'

id = sqlalchemy.Column(sqlalchemy.Integer,
primary_key=True, autoincrement=True)
date = sqlalchemy.Column(sqlalchemy.DateTime, default=datetime.datetime.now)


# text = sqlalchemy.Column(sqlalchemy.String, nullable=True)
#
# topic_id = sqlalchemy.Column(sqlalchemy.Integer, sqlalchemy.ForeignKey('topics.id'), nullable=True)
# topic = orm.relationship("Topic",
# secondary="question_to_topic",
# backref="question")

# about = sqlalchemy.Column(sqlalchemy.String, nullable=True)
# email = sqlalchemy.Column(sqlalchemy.String,
# index=True, unique=True, nullable=True)
# group = sqlalchemy.Column(sqlalchemy.String, nullable=True, default='default')
# # hashed_password = sqlalchemy.Column(sqlalchemy.String, nullable=True)
# date_of_birth = sqlalchemy.Column(sqlalchemy.Date, nullable=True)
# # created_date = sqlalchemy.Column(sqlalchemy.DateTime,
# # default=datetime.datetime.now)
# user_level = sqlalchemy.Column(sqlalchemy.String, default='student')

# news = orm.relationship("News", back_populates='user')

# def set_password(self, password):
# self.hashed_password = generate_password_hash(password)
#
# def check_password(self, password):
# return check_password_hash(self.hashed_password, password)
8 changes: 4 additions & 4 deletions data/questions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sqlalchemy
from werkzeug.security import generate_password_hash, check_password_hash
# from werkzeug.security import generate_password_hash, check_password_hash
from .db_session import SqlAlchemyBase
from sqlalchemy import orm
from flask_login import UserMixin
Expand All @@ -12,10 +12,10 @@ class Question(SqlAlchemyBase, UserMixin):
primary_key=True, autoincrement=True)
text = sqlalchemy.Column(sqlalchemy.String, nullable=True)

# topic = orm.relationship("Topic")
topic_id = sqlalchemy.Column(sqlalchemy.Integer, sqlalchemy.ForeignKey('topics.id'), nullable=True)
topic = orm.relationship("Topic",
secondary="question_to_topic",
backref="question")
secondary="question_to_topic",
backref="question")

# about = sqlalchemy.Column(sqlalchemy.String, nullable=True)
# email = sqlalchemy.Column(sqlalchemy.String,
Expand Down
Binary file modified db/database.db
Binary file not shown.

0 comments on commit 0750ee5

Please sign in to comment.