]> git.lizzy.rs Git - cheatdb.git/commitdiff
Increase comment length limit to 2000
authorrubenwardy <rw@rubenwardy.com>
Wed, 15 Jul 2020 15:01:33 +0000 (16:01 +0100)
committerrubenwardy <rw@rubenwardy.com>
Wed, 15 Jul 2020 15:01:45 +0000 (16:01 +0100)
app/blueprints/threads/__init__.py
app/models.py
migrations/versions/9832944cd1e4_.py [new file with mode: 0644]

index fbaab87fa4c8a8662fe052c4d64c792053cbe828..705703a0fc7aef3e89a6cf823618bcd67e7f1a2a 100644 (file)
@@ -141,14 +141,11 @@ def delete_reply(id):
        return redirect(thread.getViewURL())
 
 
-
-
 class CommentForm(FlaskForm):
-       comment = TextAreaField("Comment", [InputRequired(), Length(10, 500)])
+       comment = TextAreaField("Comment", [InputRequired(), Length(10, 2000)])
        submit  = SubmitField("Comment")
 
 
-
 @bp.route("/threads/<int:id>/edit/", methods=["GET", "POST"])
 @login_required
 def edit_reply(id):
@@ -226,7 +223,7 @@ def view(id):
 
 class ThreadForm(FlaskForm):
        title   = StringField("Title", [InputRequired(), Length(3,100)])
-       comment = TextAreaField("Comment", [InputRequired(), Length(10, 500)])
+       comment = TextAreaField("Comment", [InputRequired(), Length(10, 2000)])
        private = BooleanField("Private")
        submit  = SubmitField("Open Thread")
 
index af4b3b2c046450594db3315b1750bd02ecbe1345..2bb6d3dc41a10b5637595620f9c664c0283e8c47 100644 (file)
@@ -1146,7 +1146,7 @@ class Thread(db.Model):
 class ThreadReply(db.Model):
        id         = db.Column(db.Integer, primary_key=True)
        thread_id  = db.Column(db.Integer, db.ForeignKey("thread.id"), nullable=False)
-       comment    = db.Column(db.String(500), nullable=False)
+       comment    = db.Column(db.String(2000), nullable=False)
        author_id  = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False)
        created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
 
diff --git a/migrations/versions/9832944cd1e4_.py b/migrations/versions/9832944cd1e4_.py
new file mode 100644 (file)
index 0000000..1b9c84c
--- /dev/null
@@ -0,0 +1,34 @@
+"""empty message
+
+Revision ID: 9832944cd1e4
+Revises: 838081950f27
+Create Date: 2020-07-15 15:00:45.440381
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = '9832944cd1e4'
+down_revision = '838081950f27'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.alter_column('thread_reply', 'comment',
+               existing_type=sa.VARCHAR(length=500),
+               type_=sa.String(length=2000),
+               existing_nullable=False)
+    # ### end Alembic commands ###
+
+
+def downgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.alter_column('thread_reply', 'comment',
+               existing_type=sa.String(length=2000),
+               type_=sa.VARCHAR(length=500),
+               existing_nullable=False)
+    # ### end Alembic commands ###