Add a docstring to new validator
This commit is contained in:
parent
47c61655aa
commit
af7ef1c245
@ -81,6 +81,15 @@ def ListItemsUnique(message=translate("forms.validators.list_items_unique_messag
|
||||
|
||||
|
||||
def RequiredIfNot(other_field_name, message=translate("forms.validators.is_required")):
|
||||
""" A validator which makes a field required only if another field
|
||||
has a falsy value
|
||||
Args:
|
||||
other_field_name (str): the name of the field we check before
|
||||
determining if this field is required; if this other field is falsy,
|
||||
the field will be required
|
||||
message (str): an optional message to display if the field is
|
||||
required but hasNone value
|
||||
"""
|
||||
def _required_if_not(form, field):
|
||||
other_field = form._fields.get(other_field_name)
|
||||
if other_field is None:
|
||||
|
@ -154,7 +154,7 @@ class UpdateTaskOrderWorkflow(ShowTaskOrderWorkflow):
|
||||
if "portfolio_name" in self.form.data:
|
||||
new_name = self.form.data["portfolio_name"]
|
||||
old_name = self.task_order.portfolio_name
|
||||
if not new_name is old_name:
|
||||
if not new_name == old_name:
|
||||
Portfolios.update(self.task_order.portfolio, {"name": new_name})
|
||||
TaskOrders.update(self.user, self.task_order, **self.task_order_form_data)
|
||||
else:
|
||||
|
53
package.json
53
package.json
@ -1,53 +0,0 @@
|
||||
{
|
||||
"name": "atst",
|
||||
"version": "1.0.0",
|
||||
"description": "ATST Stateless Services",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"watch": "parcel watch js/index.js -d static/assets --public-url /static/assets -o index.js --no-autoinstall",
|
||||
"build": "parcel build js/index.js -d static/assets --public-url /static/assets -o index.js",
|
||||
"test": "jest",
|
||||
"test:coverage": "jest --coverage",
|
||||
"test:watch": "jest --watch --no-cache"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ally.js": "^1.4.1",
|
||||
"autoprefixer": "^9.1.3",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"date-fns": "^1.29.0",
|
||||
"npm": "^6.0.1",
|
||||
"ramda": "^0.25.0",
|
||||
"svg-innerhtml": "^1.1.0",
|
||||
"text-mask-addons": "^3.8.0",
|
||||
"uswds": "^1.6.9",
|
||||
"v-tooltip": "^2.0.0-rc.33",
|
||||
"vue": "2.5.15",
|
||||
"vue-text-mask": "^6.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/test-utils": "^1.0.0-beta.25",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-jest": "^23.6.0",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"jest": "^23.6.0",
|
||||
"jest-serializer-vue": "^2.0.2",
|
||||
"node-sass": "^4.9.2",
|
||||
"parcel-bundler": "^1.10.3",
|
||||
"vue-template-compiler": "2.5.15"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 3 version",
|
||||
"> 5%",
|
||||
"IE 10"
|
||||
],
|
||||
"jest": {
|
||||
"transform": {
|
||||
"^.+\\.js$": "<rootDir>/node_modules/babel-jest"
|
||||
},
|
||||
"snapshotSerializers": [
|
||||
"<rootDir>/node_modules/jest-serializer-vue"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user