diff --git a/app/community/forms.py b/app/community/forms.py index 098500a0..8db749db 100644 --- a/app/community/forms.py +++ b/app/community/forms.py @@ -152,7 +152,7 @@ class CreateVideoForm(FlaskForm): class CreateImageForm(FlaskForm): communities = SelectField(_l('Community'), validators=[DataRequired()], coerce=int, render_kw={'class': 'form-select'}) image_title = StringField(_l('Title'), validators=[DataRequired(), Length(min=3, max=255)]) - image_alt_text = StringField(_l('Alt text'), validators=[Optional(), Length(min=3, max=255)]) + image_alt_text = StringField(_l('Alt text'), validators=[Optional(), Length(min=3, max=1500)]) image_body = TextAreaField(_l('Body'), validators=[Optional(), Length(min=3, max=5000)], render_kw={'rows': 5}) image_file = FileField(_l('Image'), validators=[DataRequired()]) tags = StringField(_l('Tags'), validators=[Optional(), Length(min=3, max=5000)]) diff --git a/app/models.py b/app/models.py index e817f3f5..dce7e51d 100644 --- a/app/models.py +++ b/app/models.py @@ -204,7 +204,7 @@ class File(db.Model): file_name = db.Column(db.String(255)) width = db.Column(db.Integer) height = db.Column(db.Integer) - alt_text = db.Column(db.String(300)) + alt_text = db.Column(db.String(1500)) source_url = db.Column(db.String(1024)) thumbnail_path = db.Column(db.String(255)) thumbnail_width = db.Column(db.Integer) diff --git a/migrations/versions/2191fa36c09d_increase_alt_text_length.py b/migrations/versions/2191fa36c09d_increase_alt_text_length.py new file mode 100644 index 00000000..a30b3a2e --- /dev/null +++ b/migrations/versions/2191fa36c09d_increase_alt_text_length.py @@ -0,0 +1,38 @@ +"""increase alt text length + +Revision ID: 2191fa36c09d +Revises: dfba54bdaeb2 +Create Date: 2024-05-25 22:43:40.203295 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '2191fa36c09d' +down_revision = 'dfba54bdaeb2' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('file', schema=None) as batch_op: + batch_op.alter_column('alt_text', + existing_type=sa.VARCHAR(length=300), + type_=sa.String(length=1500), + existing_nullable=True) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('file', schema=None) as batch_op: + batch_op.alter_column('alt_text', + existing_type=sa.String(length=1500), + type_=sa.VARCHAR(length=300), + existing_nullable=True) + + # ### end Alembic commands ###