Skip to content

Commit

Permalink
Move / improve comment
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewelwell committed Jun 24, 2024
1 parent 3dfa2a6 commit ce87fe0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions api/features/versioning/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,16 @@ class Meta(EnvironmentFeatureVersionSerializer.Meta):
def create(
self, validated_data: dict[str, typing.Any]
) -> EnvironmentFeatureVersion:
# Note that we use self.initial_data below for handling the feature states
# since we want the raw data (rather than the serialized ORM objects) to pass
# into the serializers in the separate private methods used for modifying the
# FeatureState objects. As such, we just want to blindly remove the non-model
# attribute keys from the validated before calling super to create the version.
for field_name in self.Meta.non_model_fields:
validated_data.pop(field_name, None)

version = super().create(validated_data)

# Note that we use self.initial_data for handling the feature states here
# since we want the raw data (rather than the serialized ORM objects) to
# pass into the serializers in the separate private methods used for modifying
# the FeatureState objects.
for feature_state_to_create in self.initial_data.get(
"feature_states_to_create", []
):
Expand Down

0 comments on commit ce87fe0

Please sign in to comment.