Skip to content

Commit

Permalink
fix nullable date fields (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantownsend authored Jun 28, 2023
1 parent c69646b commit 17ad9d0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions admin_ui/src/components/InputField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
noCalendar: format == 'time'
}"
v-bind:name="columnName"
v-bind:placeholder="placeholder"
v-model="localValue"
></flat-pickr>
</template>
Expand Down
2 changes: 2 additions & 0 deletions admin_ui/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ export function convertFormValue(params: {
value = null
} else if (schema?.properties[key].format == "date-time" && value == "") {
value = null
} else if (schema?.properties[key].format == "date" && value == "") {
value = null
} else if (schema?.properties[key].type == "integer" && value == "") {
value = null
} else if (schema?.properties[key].type == "number" && value == "") {
Expand Down
2 changes: 2 additions & 0 deletions e2e/test_null_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ def test_add_nullable_columns(page: Page, dev_server):
"numeric": None,
"uuid": None,
"email": None,
"timestamp": None,
"date": None,
}
]
2 changes: 2 additions & 0 deletions piccolo_admin/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ class NullableColumns(Table):
numeric = Numeric(null=True, default=None)
uuid = UUID(null=True, default=None)
email = Email(null=True, default=None)
timestamp = Timestamp(null=True, default=None)
date = Date(null=True, default=None)


class SortedColumns(Table):
Expand Down
1 change: 1 addition & 0 deletions requirements/test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ pytest==7.3.1
pytest-cov==4.0.0
flake8==5.0.4
piccolo[postgres,sqlite]>=0.30.0
playwright==1.35.0
pytest-playwright==0.3.3
httpx>=0.20.0

0 comments on commit 17ad9d0

Please sign in to comment.