Skip to content

Commit

Permalink
Update base.py
Browse files Browse the repository at this point in the history
  • Loading branch information
williamputraintan committed Jan 6, 2025
1 parent 92ec383 commit 6190c06
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ def __init__(self, *args, camel_case_data=False, **kwargs):
super().__init__(*args, **kwargs)
self.use_camel_case = camel_case_data

def to_representation(self, instance):
representation = super().to_representation(instance)

if self.use_camel_case:
return {to_camel_case(key): value for key, value in representation.items()}
return representation



class OptionalFieldsMixin:
def make_fields_optional(self):
Expand Down

0 comments on commit 6190c06

Please sign in to comment.