Skip to content

Commit

Permalink
fix after removal of NullBooleanField from DRF
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszn committed Aug 1, 2023
1 parent 7df58cf commit 8f5204d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
8 changes: 0 additions & 8 deletions rest/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def to_representation(self, value):

MODEL_BOOLEAN_FIELDS = (
model_fields.BooleanField,
model_fields.NullBooleanField,
)


Expand Down Expand Up @@ -173,13 +172,6 @@ def get_fields_for_config(self):

if not has_wq_config:
fields.pop(name)
elif isinstance(field, serializers.NullBooleanField):
fields[name] = serializers.ChoiceField(
choices=self.get_boolean_choices(field),
required=False,
label=field.label,
help_text=field.help_text,
)
elif isinstance(field, serializers.BooleanField):
fields[name] = serializers.ChoiceField(
choices=self.get_boolean_choices(field),
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def find_wq_packages(submodule):
long_description_content_type="text/markdown",
install_requires=[
'Django>=1.11,<5.0',
'djangorestframework>=3.8.0,<3.14.0',
'djangorestframework>=3.8.0,<3.15.0',
'html-json-forms',
'natural-keys>=1.6.0',
],
Expand Down
2 changes: 1 addition & 1 deletion tests/rest_app/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=10)),
('active', models.NullBooleanField(default=True)),
('active', models.BooleanField(default=True, null=True)),
],
options={
'abstract': False,
Expand Down
2 changes: 1 addition & 1 deletion tests/rest_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Child(LabelModel):

class ItemType(LabelModel):
name = models.CharField(max_length=10)
active = models.NullBooleanField(default=True)
active = models.BooleanField(default=True, null=True)


class Item(LabelModel):
Expand Down

0 comments on commit 8f5204d

Please sign in to comment.