Closed mfogel closed 4 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 98.64%. Comparing base (
bb20f86
) to head (610a2c2
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@mfogel
I don't think changing Field
to CharField
is a good solution.
And this change is a BREAKING change.
Because in TimeZoneSerializerField
's __init__
using super().__init__(*args, **kwargs)
, but in CharField
's __init__
it does't support *arg
:
class CharField(Field):
...
def __init__(self, **kwargs):
Therefore, changing Field
to CharField
not only loses flexibility, but also makes all existing subclasses of TimeZoneSerializerField
that using *args
unusable. I believe a better solution is to use a custom validator instead of changing the original default behavior to fit the DRF's parameters.
What
Field
toCharField
required
,allow_null
, andallow_blank
kwargs are all working as documented by DJRFWhy
Subclassing
Field
introduces some situations where it isn't clear what the correct behavior is. DJRF addressed this forCharField
in their 3.0 release - let's leverage their solution here.Closes #130