Skip to content

Commit 8a8be4f

Browse files
Add NullableBooleanInput (#792)
1 parent 0d9a302 commit 8a8be4f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

admin-js/src/App.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import {
1414
BooleanField, DateField, NumberField, ReferenceField, ReferenceManyField,
1515
ReferenceOneField, SelectField, TextField,
1616
// Inputs
17-
BooleanInput, DateInput, DateTimeInput, NumberInput, SelectInput, TextInput,
17+
BooleanInput, DateInput, DateTimeInput, NullableBooleanInput, NumberInput,
18+
SelectInput, TextInput,
1819
TimeInput as _TimeInput, ReferenceInput as _ReferenceInput,
1920
// Filters
2021
email, maxLength, maxValue, minLength, minValue, regex, required,
@@ -65,8 +66,8 @@ const COMPONENTS = {
6566
BooleanField, DateField, NumberField, ReferenceField, ReferenceManyField,
6667
ReferenceOneField, SelectField, TextField, TimeField,
6768

68-
BooleanInput, DateInput, DateTimeInput, NumberInput, ReferenceInput, SelectInput,
69-
TextInput, TimeInput
69+
BooleanInput, DateInput, DateTimeInput, NullableBooleanInput, NumberInput,
70+
ReferenceInput, SelectInput, TextInput, TimeInput
7071
};
7172
const FUNCTIONS = {email, maxLength, maxValue, minLength, minValue, regex, required};
7273
const _body = document.querySelector("body");

aiohttp_admin/backends/sqlalchemy.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ def __init__(self, db: AsyncEngine, model_or_table: Union[sa.Table, type[Declara
180180
else:
181181
field, inp, props = get_components(c.type)
182182

183+
if inp == "BooleanInput" and c.nullable:
184+
inp = "NullableBooleanInput"
185+
183186
props["source"] = c.name
184187
if isinstance(c.type, sa.Enum):
185188
props["choices"] = tuple({"id": e.value, "name": e.name}

0 commit comments

Comments
 (0)