Skip to content

Commit

Permalink
Fix enum field custom kwargs (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
shosca authored Dec 13, 2018
1 parent b554a76 commit c21805f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rest_witchcraft/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ def build_standard_field_kwargs(self, field_name, field_class, column_info):
field_kwargs["label"] = capfirst(" ".join(field_name.split("_")).strip())
field_kwargs["allow_null"] = not field_kwargs.get("required", True)

# Include any kwargs defined in `Meta.extra_kwargs`
field_kwargs = self.include_extra_kwargs(field_kwargs, self._extra_kwargs.get(field_name))

if "choices" in field_kwargs:
# Fields with choices get coerced into `ChoiceField`
# instead of using their regular typed field.
Expand Down Expand Up @@ -81,6 +78,9 @@ def build_standard_field_kwargs(self, field_name, field_class, column_info):
if key not in valid_kwargs:
del field_kwargs[key] # pragma: nocover

# Include any kwargs defined in `Meta.extra_kwargs`
field_kwargs = self.include_extra_kwargs(field_kwargs, self._extra_kwargs.get(field_name))

if not issubclass(field_class, fields.CharField) and not issubclass(field_class, fields.ChoiceField):
# `allow_blank` is only valid for textual fields.
field_kwargs.pop("allow_blank", None)
Expand Down

0 comments on commit c21805f

Please sign in to comment.