Open glassresistor opened 4 years ago
You can fix the problem with the timezone by overriding the to_internal_value and to_representation functions. If you use TimezoneField in serializer parts, the problem will be solved. That's how I solved it.
class TimezoneField(serializers.Field):
def to_representation(self, obj):
return six.text_type(obj)
def to_internal_value(self, data):
try:
return pytz.timezone(str(data))
except pytz.exceptions.UnknownTimeZoneError:
raise ValidationError('Unknown timezone')
@keremvatandas Does that fix still work for you? We're getting the same error with that fix:
Object of type Africa/Abidjan is not JSON serializable
Celerybeat is a very common problem and just adding it as an app and the basic yasg config causes this error.