Commit 48589d0d authored by Jo Sama's avatar Jo Sama 😱
Browse files

Exclude/include fields when serializing

parent a1ce2c93
......@@ -153,6 +153,10 @@ class BranchReference(BaseModel):
'extra_b': {'alias': 'extraB'},
}
def dict(self, *args, **kwargs):
kwargs['include'] = {'id'}
return super(BranchReference, self).dict(*args, **kwargs)
class Operator(BaseModel):
id: Optional[str]
......@@ -173,6 +177,10 @@ class Operator(BaseModel):
'mobile': {'alias': 'mobileNumber'},
}
def dict(self, *args, **kwargs):
kwargs['exclude'] = {'id'}
return super(Operator, self).dict(*args, **kwargs)
class Person(BaseModel):
id: Optional[str]
......@@ -194,3 +202,7 @@ class Person(BaseModel):
'phone': 'phoneNumber',
'mobile': 'mobileNumber'
}
def dict(self, *args, **kwargs):
kwargs['exclude'] = {'id'}
return super(Person, self).dict(*args, **kwargs)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment