Hi,

Is there a reason you want to reject requests with extra data rather than
just ignore extra values?

One way to do that could be whitelisting allowed params per view but that
you have to do yourself. You could probably use DRF authentication API for
that.

15.1.2018 18.43 "Daniel Chimeno" <dan...@chimeno.me> kirjoitti:

> Hello!
>
> How could I deny requests that has additional properties?
> Example:
>
> class IntervalSerializer(serializers.Serializer):
>     month = serializers.DateField(format='%Y-%m', input_formats=['%Y-%m'])
>     day_of_week = serializers.IntegerField(min_value=1, max_value=7)
>     start_hour = serializers.IntegerField(min_value=0, max_value=24)
>     end_hour = serializers.IntegerField(min_value=1, max_value=24)
>
> I would like to allow incoming requests like:
> {'month': '2017-03', 'day_of_week': 7, 'start_hour': 3, 'end_hour': 2}
>
>
> but to not allow incoming requestse like:
> {'month': '2017-03', 'day_of_week': 7, 'start_hour': 3, 'end_hour': 2,
> 'another_attribute': 3}
>
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django REST framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-rest-framework+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to