List validator

16 views
Skip to first unread message

Larry Martell

unread,
Feb 27, 2023, 3:42:22 PM2/27/23
to django...@googlegroups.com
I have this defined in my serializer:

    case_status = serializers.ListField(
        child=serializers.CharField(
            allow_blank=True,
            max_length=512,
            allow_null=True,
            required=False,
            default="''",
        ),    
        source='casestatus',
        required=False,
        allow_empty=True,
    )
When this data is received:

(Pdb) request.data
<QueryDict: {'casestatus': ['Rejected'], 'page_size': ['10']}>
The casestatus field is not picked up:
(Pdb) serializer.validated_data
OrderedDict([('patientid', 0), ('pk', 0), ('patientname', "''"), ('dobstart', "''"), ('dobend', "''"), ('scanstart', "''"), ('scanend', "''"), ('workitemstr', "''"), ('institutionid', 0), ('page_size', 10), ('sortByDateCreated', 'true')])
Can anyone see what I am doing wrong here?

Geo Jacob

unread,
Feb 28, 2023, 10:00:14 AM2/28/23
to django...@googlegroups.com
Larry,

It seems like request data field name don't have underscore. It should be case_status instead of casestatus

Regards,
Geo


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACwCsY6-wEO-vVDn_mhb8t0-w2C5vXyw-08EeuUeiAPmMK_oqw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages