Re: validator not working in serializers.ModelSerializer

2019-01-29 Thread Ayomide Onibokun
does python has a similar cms like wordpress? On Tue, 29 Jan 2019 at 03:36, Maurya Allimuthu wrote: > Hi Andréas, > > I have fixed it. like subclassing the serializer field class and > overriding the to_representation for per field. > Thanks for the help once again. > > Thanks, > Maurya > > On

Re: validator not working in serializers.ModelSerializer

2019-01-28 Thread Maurya Allimuthu
Hi Andréas, I have fixed it. like subclassing the serializer field class and overriding the to_representation for per field. Thanks for the help once again. Thanks, Maurya On Fri, Jan 25, 2019 at 10:50 PM Andréas Kühne wrote: > If you want to change the output, you can override the fields tha

Re: validator not working in serializers.ModelSerializer

2019-01-28 Thread Maurya Allimuthu
Many thanks Andreas :-) On Thursday, January 24, 2019 at 8:40:35 PM UTC+8, Andréas Kühne wrote: > > Hi, > > Validators are only called when you are updating something on the model - > a get request doesn't update anything and the validators will not be called > (there is no data sent to the serv

Re: validator not working in serializers.ModelSerializer

2019-01-25 Thread Andréas Kühne
If you want to change the output, you can override the fields that you output in your serializer. That's what the fields are for? I think it would be helpful if you provide more information because at least I don't really understand your use-case. The way I would do it is to change the fields and

Re: validator not working in serializers.ModelSerializer

2019-01-24 Thread Maurya Allimuthu
Hi Andreas Kuhne, Thanks on the quick answer and great help. :-) Hi Andreas Kuhne/All, Is there a way or any kind of approach, I can use validators/anything in GET method to format/change the output of the data coming from database and before getting changed by serializer as stream of strings. P

Re: validator not working in serializers.ModelSerializer

2019-01-24 Thread Andréas Kühne
Hi, Validators are only called when you are updating something on the model - a get request doesn't update anything and the validators will not be called (there is no data sent to the server to validate). The validators will be called on a POST, PUT or PATCH request. Regards, Andréas Den tors

validator not working in serializers.ModelSerializer

2019-01-24 Thread Maurya Allimuthu
Hi All, I use serializers.ModelSerializer and viewset DetailViewset(APIView). The validators are not getting called on GET request of the viewset via URLS, but the GET request is working. def validate(self, attrs): if attrs.get('password') != attrs.get('confirm_password'): raise s