Skip to content

UmarFarooq-Ch/Django-DynamicFieldsModelSerializer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Example

>>> class UserSerializer(DynamicFieldsModelSerializer):
>>>     class Meta:
>>>         model = User
>>>         fields = ['id', 'username', 'email']
>>>
>>> print(UserSerializer(user))
{'id': 2, 'username': 'jonwatts', 'email': 'jon@example.com'}
>>>
>>> print(UserSerializer(user, fields=('id', 'email')))
{'id': 2, 'email': 'jon@example.com'}
>>> print(UserSerializer(user, exclude_fields=('id')))
{'username': 'jonwatts', 'email': 'jon@example.com'}

About

DynamicFieldsModelSerializer with exclude_fields functionality

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages