From ea7b76f943abd94e81003517b0751f3c310d505e Mon Sep 17 00:00:00 2001 From: Xavier Ordoquy Date: Fri, 14 Feb 2014 15:44:59 +0100 Subject: [PATCH] Fixed regression & added comments. --- rest_framework/serializers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 80112e49e..3724b8112 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -196,13 +196,15 @@ class BaseSerializer(WritableField): self.partial = partial self.many = many - # Handle allow_add_remove depreaction + # Handle allow_add_remove depreaction if hasattr(self, 'allow_add_remove'): + # If we already have allow_add_remove, it's a class argument. + # By reassigning it we'll trigger the batch_mode configuration warnings.warn('The `allow_add_remove` keyword argument is deprecated. ' 'Use the `batch_mode` keyword argument instead.', DeprecationWarning, stacklevel=2) self.allow_add_remove = self.allow_add_remove - if 'allow_add_remove' in kwargs: + if allow_add_remove: warnings.warn('The `allow_add_remove` keyword argument is deprecated. ' 'Use the `batch_mode` keyword argument instead.', DeprecationWarning, stacklevel=2)