Add ProjectForm class that does not include environments for edit project form
This commit is contained in:
parent
bc76ef633e
commit
25b84a4df6
@ -4,12 +4,14 @@ from wtforms.validators import Required
|
|||||||
from atst.forms.validators import ListItemRequired, ListItemsUnique
|
from atst.forms.validators import ListItemRequired, ListItemsUnique
|
||||||
|
|
||||||
|
|
||||||
class NewProjectForm(FlaskForm):
|
class ProjectForm(FlaskForm):
|
||||||
|
|
||||||
EMPTY_ENVIRONMENT_NAMES = ["", None]
|
|
||||||
|
|
||||||
name = StringField(label="Project Name", validators=[Required()])
|
name = StringField(label="Project Name", validators=[Required()])
|
||||||
description = TextAreaField(label="Description", validators=[Required()])
|
description = TextAreaField(label="Description", validators=[Required()])
|
||||||
|
|
||||||
|
|
||||||
|
class NewProjectForm(ProjectForm):
|
||||||
|
EMPTY_ENVIRONMENT_NAMES = ["", None]
|
||||||
|
|
||||||
environment_names = FieldList(
|
environment_names = FieldList(
|
||||||
StringField(label="Environment Name"),
|
StringField(label="Environment Name"),
|
||||||
validators=[
|
validators=[
|
@ -17,7 +17,7 @@ from atst.domain.workspaces import Workspaces
|
|||||||
from atst.domain.workspace_users import WorkspaceUsers
|
from atst.domain.workspace_users import WorkspaceUsers
|
||||||
from atst.domain.environments import Environments
|
from atst.domain.environments import Environments
|
||||||
from atst.domain.environment_roles import EnvironmentRoles
|
from atst.domain.environment_roles import EnvironmentRoles
|
||||||
from atst.forms.new_project import NewProjectForm
|
from atst.forms.project import NewProjectForm, ProjectForm
|
||||||
from atst.forms.new_member import NewMemberForm
|
from atst.forms.new_member import NewMemberForm
|
||||||
from atst.forms.edit_member import EditMemberForm
|
from atst.forms.edit_member import EditMemberForm
|
||||||
from atst.forms.workspace import WorkspaceForm
|
from atst.forms.workspace import WorkspaceForm
|
||||||
@ -196,7 +196,7 @@ def edit_project(workspace_id, project_id):
|
|||||||
def update_project(workspace_id, project_id):
|
def update_project(workspace_id, project_id):
|
||||||
workspace = Workspaces.get_for_update_projects(g.current_user, workspace_id)
|
workspace = Workspaces.get_for_update_projects(g.current_user, workspace_id)
|
||||||
project = Projects.get(g.current_user, workspace, project_id)
|
project = Projects.get(g.current_user, workspace, project_id)
|
||||||
form = NewProjectForm(http_request.form)
|
form = ProjectForm(http_request.form)
|
||||||
if form.validate():
|
if form.validate():
|
||||||
project_data = form.data
|
project_data = form.data
|
||||||
Projects.update(g.current_user, workspace, project, project_data)
|
Projects.update(g.current_user, workspace, project, project_data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user