Skip to content

Commit

Permalink
⏪️(backend) remove is_main default hack
Browse files Browse the repository at this point in the history
As DRF encode/django-rest-framework#9030 has
been reverted in 3.15.1, the related hack is no longer needed.
  • Loading branch information
kernicPanel committed Mar 25, 2024
1 parent 742e598 commit c1c7a39
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
10 changes: 0 additions & 10 deletions src/backend/joanie/core/serializers/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import markdown
from drf_spectacular.utils import extend_schema_field
from rest_framework import exceptions, serializers
from rest_framework.fields import empty
from rest_framework.generics import get_object_or_404

from joanie.core import enums, models
Expand Down Expand Up @@ -86,15 +85,6 @@ class Meta:
"id",
]

def run_validation(self, data=empty):
"""
Ignore is_main if not present in the data
"""
validated_data = super().run_validation(data)
if "is_main" not in data:
del validated_data["is_main"]
return validated_data


class CourseLightSerializer(AbilitiesModelSerializer):
"""
Expand Down
10 changes: 0 additions & 10 deletions src/backend/joanie/payment/serializers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Serializers for api."""

from rest_framework import serializers
from rest_framework.fields import empty

from joanie.payment import models

Expand Down Expand Up @@ -31,12 +30,3 @@ class Meta:
"expiration_year",
"last_numbers",
]

def run_validation(self, data=empty):
"""
Ignore is_main if not present in the data
"""
validated_data = super().run_validation(data)
if "is_main" not in data:
del validated_data["is_main"]
return validated_data

0 comments on commit c1c7a39

Please sign in to comment.