fhfdfhjsklfd

This commit is contained in:
codl 2017-07-31 18:29:09 +02:00
parent e044493acc
commit 7301bc8a8b
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
5 changed files with 96 additions and 9 deletions

View File

@ -0,0 +1,28 @@
"""empty message
Revision ID: 711770097f06
Revises: e46c5fd68037
Create Date: 2017-07-31 17:54:11.215759
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '711770097f06'
down_revision = 'e46c5fd68037'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('accounts', sa.Column('policy_ignore_favourites', sa.Boolean(), server_default='TRUE', nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('accounts', 'policy_ignore_favourites')
# ### end Alembic commands ###

View File

@ -0,0 +1,28 @@
"""empty message
Revision ID: e46c5fd68037
Revises: f11fe22d6169
Create Date: 2017-07-31 17:10:09.833883
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e46c5fd68037'
down_revision = 'f11fe22d6169'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('accounts', sa.Column('policy_enabled', sa.Boolean(), server_default='FALSE', nullable=False))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('accounts', 'policy_enabled')
# ### end Alembic commands ###

View File

@ -37,11 +37,11 @@ class Account(db.Model, TimestampMixin, RemoteIDMixin):
__tablename__ = 'accounts'
id = db.Column(db.String, primary_key=True)
# policy_enabled = db.Column(db.Boolean, server_default='FALSE', nullable=False)
policy_enabled = db.Column(db.Boolean, server_default='FALSE', nullable=False)
# policy_keep_younger = db.Column(db.Interval)
# policy_keep_latest = db.Column(db.Integer)
# policy_delete_every = db.Column(db.Interval)
# policy_ignore_favourites = db.Column(db.Boolean, server_default='TRUE')
policy_ignore_favourites = db.Column(db.Boolean, server_default='TRUE')
remote_display_name = db.Column(db.String)
remote_screen_name = db.Column(db.String)

View File

@ -67,11 +67,20 @@ def upload_tweet_archive():
return render_template('upload_tweet_archive.html')
@app.route('/settings')
@app.route('/settings', methods=('GET', 'POST'))
@require_auth
def settings():
if request.method == 'POST':
for attr in ('policy_enabled', 'policy_ignore_favourites'):
if attr in request.form:
setattr(g.viewer.account, attr, request.form[attr])
db.session.commit()
return render_template('settings.html')
@app.route('/logout')
@require_auth
def logout():

View File

@ -1,14 +1,36 @@
<p><a href="{{url_for('index')}}">&lt; Back</a></p>
<form method='post' enctype='multipart/form-data'>
<h2>Settings</h2>
<p>Delete posts:
<label><input type=radio name=policy_enabled value=true {{ "checked" if g.viewer.account.policy_enabled }}> Enabled</label>
<label><input type=radio name=policy_enabled value=false {{ "checked" if not g.viewer.account.policy_enabled }}> Disabled</label>
</p>
{#
<p>Keep posts less than
<input type=number name=policy_keep_younger min=0 step=1 max=30>
<select name=policy_keep_younger_multiplier>
<option name=1>seconds</option>
<option name=60>minutes</option>
<option name=3600>hours</option>
<option name=86400>days</option>
<option name=2635200>months</option>
<option name=31536000>years</option>
</select>
old
</p>
#}
<p>Keep posts that you have favourited:
<label><input type=radio name=policy_ignore_favourites value=true {{ "checked" if g.viewer.account.policy_ignore_favourites }}> Yes</label>
<label><input type=radio name=policy_ignore_favourites value=false {{ "checked" if not g.viewer.account.policy_ignore_favourites }}> No</label>
</p>
<input type=submit value='Save'>
</form>
{% if g.viewer.account.service == 'twitter' %}
<form action='{{url_for('upload_tweet_archive')}}' method='post' enctype='multipart/form-data'>
<h2>Tweet archive import</h2>
Upload your tweet archive:
<input type="file" name='file'><input type="submit">
</form>
{% endif %}
<form method='post' enctype='multipart/form-data'>
ahh
</form>