Skip to content

Commit

Permalink
rewrite logic removed in pydantic#1755
Browse files Browse the repository at this point in the history
  • Loading branch information
PrettyWood committed Dec 2, 2020
1 parent 63c3fd6 commit d94a53a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pydantic/main.py
Expand Up @@ -788,12 +788,12 @@ def _iter(
value_include = ValueItems(self, include) if include else None

for field_key, v in self.__dict__.items():
if (
(allowed_keys is not None and field_key not in allowed_keys)
or (exclude_none and v is None)
or (exclude_defaults and getattr(self.__fields__.get(field_key), 'default', _missing) == v)
):
if (allowed_keys is not None and field_key not in allowed_keys) or (exclude_none and v is None):
continue
if exclude_defaults:
model_field = self.__fields__.get(field_key)
if not getattr(model_field, 'required', True) and getattr(model_field, 'default', _missing) == v:
continue
if by_alias and field_key in self.__fields__:
dict_key = self.__fields__[field_key].alias
else:
Expand Down

0 comments on commit d94a53a

Please sign in to comment.