stuff
This commit is contained in:
35
db_repository/versions/004_istrained.py
Normal file
35
db_repository/versions/004_istrained.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from sqlalchemy import *
|
||||
from migrate import *
|
||||
|
||||
|
||||
from migrate.changeset import schema
|
||||
pre_meta = MetaData()
|
||||
post_meta = MetaData()
|
||||
threads = Table('threads', post_meta,
|
||||
Column('created_at', TIMESTAMP, nullable=False),
|
||||
Column('updated_at', TIMESTAMP, nullable=False),
|
||||
Column('id', Integer, primary_key=True, nullable=False),
|
||||
Column('firstmail', Integer),
|
||||
Column('date', DateTime),
|
||||
Column('islabeled', Boolean),
|
||||
Column('istrained', Boolean),
|
||||
Column('opened', Boolean),
|
||||
Column('body', Text),
|
||||
Column('maintopic', String),
|
||||
)
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
# Upgrade operations go here. Don't create your own engine; bind
|
||||
# migrate_engine to your metadata
|
||||
pre_meta.bind = migrate_engine
|
||||
post_meta.bind = migrate_engine
|
||||
post_meta.tables['threads'].columns['istrained'].create()
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
# Operations to reverse the above upgrade go here.
|
||||
pre_meta.bind = migrate_engine
|
||||
post_meta.bind = migrate_engine
|
||||
post_meta.tables['threads'].columns['istrained'].drop()
|
||||
|
||||
@@ -52,3 +52,9 @@ def store_answered(id, value):
|
||||
def studium():
|
||||
mth=db_session.query(MailThread).filter(MailThread.maintopic=="studium").order_by(desc(MailThread.date)).all()
|
||||
return render_index(mth)
|
||||
|
||||
|
||||
@app.route("/<maintopic>")
|
||||
def maintopic(maintopic):
|
||||
mth=db_session.query(MailThread).filter(MailThread.maintopic=="%s" % maintopic).order_by(desc(MailThread.date)).all()
|
||||
return render_index(mth)
|
||||
|
||||
@@ -31,7 +31,10 @@
|
||||
<div id="collapse{{m.firstmail}}" class="collapse" role="tabpanel" aria-labelledby="headingOne">
|
||||
|
||||
<div class="card-block">
|
||||
<div style="white-space: pre-wrap;font:Courier, monospace; font-size:small; width:50em; border: thin blue solid;"> {{ m.print_text() }} </div>
|
||||
{{m.maintopic}}
|
||||
<div style="white-space: pre-wrap;font:Courier, monospace; font-size:small; width:50em; border: thin blue solid;">
|
||||
{{ m.print_text() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,5 +6,6 @@ numpy
|
||||
scipy
|
||||
bs4
|
||||
sqlalchemy
|
||||
sqlalchemy-migrate
|
||||
marshmallow
|
||||
PyYAML
|
||||
|
||||
@@ -25,6 +25,7 @@ class MailThread(Base):
|
||||
firstmail = Column(Integer)
|
||||
date = Column(DateTime)
|
||||
islabeled = Column(Boolean)
|
||||
istrained = Column(Boolean)
|
||||
opened = Column(Boolean)
|
||||
body = Column(Text)
|
||||
maintopic=Column(String)
|
||||
|
||||
Reference in New Issue
Block a user