Fix problems that drf-yasg uncovered.
These were originally fixed individually, but had to be reverted, and are now combined in one commit. The originals were:7b9040f6b0This enum was backwards8774ff1f9bUse ref_name to disambiguate serializers that drf-yasg would otherwise assume are the same.8a44397139Is this field missing because it is None?4a1154a7caGive a safer buffer for clearing the rate limiting64c47856ddDRF 3.7.4 changed how you delegate to another view, so don't7359ca4fb2Is this right? It fixes two testsfdd66e5390Adjust the expected error message for DRF 3.7.79257f68fd8The default TIME_ZONE should be UTC
This commit is contained in:
@@ -45,6 +45,10 @@ class CourseSerializer(serializers.Serializer): # pylint: disable=abstract-meth
|
||||
invite_only = serializers.BooleanField(source="invitation_only")
|
||||
course_modes = serializers.SerializerMethodField()
|
||||
|
||||
class Meta(object):
|
||||
# For disambiguating within the drf-yasg swagger schema
|
||||
ref_name = 'enrollment.Course'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.include_expired = kwargs.pop("include_expired", False)
|
||||
super(CourseSerializer, self).__init__(*args, **kwargs)
|
||||
|
||||
@@ -551,7 +551,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
|
||||
("level_of_education", "none", u"ȻħȺɍłɇs", u'"ȻħȺɍłɇs" is not a valid choice.'),
|
||||
("country", "GB", "XY", u'"XY" is not a valid choice.'),
|
||||
("year_of_birth", 2009, "not_an_int", u"A valid integer is required."),
|
||||
("name", "bob", "z" * 256, u"Ensure this value has at most 255 characters (it has 256)."),
|
||||
("name", "bob", "z" * 256, u"Ensure this field has no more than 255 characters."),
|
||||
("name", u"ȻħȺɍłɇs", " ", u"The name field must be at least 1 character long."),
|
||||
("goals", "Smell the roses"),
|
||||
("mailing_address", "Sesame Street"),
|
||||
|
||||
@@ -470,7 +470,7 @@ def get_expected_validation_developer_message(preference_key, preference_value):
|
||||
preference_key=preference_key,
|
||||
preference_value=preference_value,
|
||||
error={
|
||||
"key": [u"Ensure this value has at most 255 characters (it has 256)."]
|
||||
"key": [u"Ensure this field has no more than 255 characters."]
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
|
||||
# This list is the minimal set required by the notification service
|
||||
fields = ("id", "url", "email", "name", "username", "preferences")
|
||||
read_only_fields = ("id", "email", "username")
|
||||
# For disambiguating within the drf-yasg swagger schema
|
||||
ref_name = 'user_api.User'
|
||||
|
||||
|
||||
class UserPreferenceSerializer(serializers.HyperlinkedModelSerializer):
|
||||
|
||||
Reference in New Issue
Block a user