|
30 | 30 | from django.utils.translation import gettext_lazy as _
|
31 | 31 | from pytz.exceptions import InvalidTimeError
|
32 | 32 |
|
33 |
| -from rest_framework import ( |
34 |
| - ISO_8601, RemovedInDRF313Warning, RemovedInDRF314Warning |
35 |
| -) |
| 33 | +from rest_framework import ISO_8601, RemovedInDRF314Warning |
36 | 34 | from rest_framework.exceptions import ErrorDetail, ValidationError
|
37 | 35 | from rest_framework.settings import api_settings
|
38 | 36 | from rest_framework.utils import html, humanize_datetime, json, representation
|
@@ -265,16 +263,6 @@ def __call__(self, serializer_field):
|
265 | 263 | if is_update:
|
266 | 264 | raise SkipField()
|
267 | 265 | if callable(self.default):
|
268 |
| - if hasattr(self.default, 'set_context'): |
269 |
| - warnings.warn( |
270 |
| - "Method `set_context` on defaults is deprecated and will " |
271 |
| - "no longer be called starting with 3.13. Instead set " |
272 |
| - "`requires_context = True` on the class, and accept the " |
273 |
| - "context as an additional argument.", |
274 |
| - RemovedInDRF313Warning, stacklevel=2 |
275 |
| - ) |
276 |
| - self.default.set_context(self) |
277 |
| - |
278 | 266 | if getattr(self.default, 'requires_context', False):
|
279 | 267 | return self.default(serializer_field)
|
280 | 268 | else:
|
@@ -504,16 +492,6 @@ def get_default(self):
|
504 | 492 | # No default, or this is a partial update.
|
505 | 493 | raise SkipField()
|
506 | 494 | if callable(self.default):
|
507 |
| - if hasattr(self.default, 'set_context'): |
508 |
| - warnings.warn( |
509 |
| - "Method `set_context` on defaults is deprecated and will " |
510 |
| - "no longer be called starting with 3.13. Instead set " |
511 |
| - "`requires_context = True` on the class, and accept the " |
512 |
| - "context as an additional argument.", |
513 |
| - RemovedInDRF313Warning, stacklevel=2 |
514 |
| - ) |
515 |
| - self.default.set_context(self) |
516 |
| - |
517 | 495 | if getattr(self.default, 'requires_context', False):
|
518 | 496 | return self.default(self)
|
519 | 497 | else:
|
@@ -578,16 +556,6 @@ def run_validators(self, value):
|
578 | 556 | """
|
579 | 557 | errors = []
|
580 | 558 | for validator in self.validators:
|
581 |
| - if hasattr(validator, 'set_context'): |
582 |
| - warnings.warn( |
583 |
| - "Method `set_context` on validators is deprecated and will " |
584 |
| - "no longer be called starting with 3.13. Instead set " |
585 |
| - "`requires_context = True` on the class, and accept the " |
586 |
| - "context as an additional argument.", |
587 |
| - RemovedInDRF313Warning, stacklevel=2 |
588 |
| - ) |
589 |
| - validator.set_context(self) |
590 |
| - |
591 | 559 | try:
|
592 | 560 | if getattr(validator, 'requires_context', False):
|
593 | 561 | validator(value, self)
|
|
0 commit comments