From 43ac433409a001c7de94bf84d4c153c35d140658 Mon Sep 17 00:00:00 2001 From: Nicolas Clerc Date: Mon, 25 Mar 2024 14:06:49 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(backend)=20remove=20is=5Fmain=20de?= =?UTF-8?q?fault=20hack?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As DRF https://github.com/encode/django-rest-framework/pull/9030 has been reverted in 3.15.1, the related hack is no longer needed. --- src/backend/joanie/core/serializers/client.py | 10 ---------- src/backend/joanie/payment/serializers.py | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/src/backend/joanie/core/serializers/client.py b/src/backend/joanie/core/serializers/client.py index 3693e0bbc7..d6a5d981d8 100644 --- a/src/backend/joanie/core/serializers/client.py +++ b/src/backend/joanie/core/serializers/client.py @@ -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 @@ -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): """ diff --git a/src/backend/joanie/payment/serializers.py b/src/backend/joanie/payment/serializers.py index 375cdd6fb2..f9babd08bb 100644 --- a/src/backend/joanie/payment/serializers.py +++ b/src/backend/joanie/payment/serializers.py @@ -1,7 +1,6 @@ """Serializers for api.""" from rest_framework import serializers -from rest_framework.fields import empty from joanie.payment import models @@ -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