Make application description optional
This commit is contained in:
parent
da6916b1a1
commit
237123d474
@ -0,0 +1,31 @@
|
|||||||
|
"""Make application description optional
|
||||||
|
|
||||||
|
Revision ID: f50596c5ffbb
|
||||||
|
Revises: e3d93f9caba7
|
||||||
|
Create Date: 2019-10-08 09:41:11.835664
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = "f50596c5ffbb" # pragma: allowlist secret
|
||||||
|
down_revision = "e3d93f9caba7" # pragma: allowlist secret
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.alter_column(
|
||||||
|
"applications", "description", existing_type=sa.VARCHAR(), nullable=True
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.alter_column(
|
||||||
|
"applications", "description", existing_type=sa.VARCHAR(), nullable=False
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
@ -1,6 +1,6 @@
|
|||||||
from .forms import BaseForm
|
from .forms import BaseForm
|
||||||
from wtforms.fields import StringField, TextAreaField, FieldList
|
from wtforms.fields import StringField, TextAreaField, FieldList
|
||||||
from wtforms.validators import Required
|
from wtforms.validators import Required, Optional
|
||||||
from atst.forms.validators import ListItemRequired, ListItemsUnique
|
from atst.forms.validators import ListItemRequired, ListItemsUnique
|
||||||
from atst.utils.localization import translate
|
from atst.utils.localization import translate
|
||||||
|
|
||||||
@ -16,7 +16,9 @@ class NameAndDescriptionForm(BaseForm):
|
|||||||
label=translate("forms.application.name_label"), validators=[Required()]
|
label=translate("forms.application.name_label"), validators=[Required()]
|
||||||
)
|
)
|
||||||
description = TextAreaField(
|
description = TextAreaField(
|
||||||
label=translate("forms.application.description_label"), validators=[Required()]
|
label=translate("forms.application.description_label"),
|
||||||
|
validators=[Optional()],
|
||||||
|
filters=[lambda x: x or None],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class Application(
|
|||||||
|
|
||||||
id = Id()
|
id = Id()
|
||||||
name = Column(String, nullable=False)
|
name = Column(String, nullable=False)
|
||||||
description = Column(String, nullable=False)
|
description = Column(String)
|
||||||
|
|
||||||
portfolio_id = Column(ForeignKey("portfolios.id"), nullable=False)
|
portfolio_id = Column(ForeignKey("portfolios.id"), nullable=False)
|
||||||
portfolio = relationship("Portfolio")
|
portfolio = relationship("Portfolio")
|
||||||
|
@ -36,7 +36,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-col form-col--two-thirds">
|
<div class="form-col form-col--two-thirds">
|
||||||
{{ TextInput(form.description, paragraph=True, optional=False) }}
|
{{ TextInput(form.description, paragraph=True, optional=True) }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-col form-col--two-thirds">
|
<div class="form-col form-col--two-thirds">
|
||||||
{{ TextInput(application_form.name, optional=False) }}
|
{{ TextInput(application_form.name, optional=False) }}
|
||||||
{{ TextInput(application_form.description, paragraph=True, optional=False) }}
|
{{ TextInput(application_form.description, paragraph=True, optional=True) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user