does python has a similar cms like wordpress? On Tue, 29 Jan 2019 at 03:36, Maurya Allimuthu <[email protected]> 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 Fri, Jan 25, 2019 at 10:50 PM Andréas Kühne <[email protected]> > wrote: > >> 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 format them the way I >> wanted them to be on a get request. >> >> Regards, >> >> Andréas >> >> >> Den fre 25 jan. 2019 kl 02:47 skrev Maurya Allimuthu < >> [email protected]>: >> >>> 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. >>> Please let me know if any. >>> >>> Regards, >>> Maurya >>> >>> On Thu, Jan 24, 2019 at 8:40 PM Andréas Kühne < >>> [email protected]> 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 server to validate). The validators >>>> will be called on a POST, PUT or PATCH request. >>>> >>>> Regards, >>>> >>>> Andréas >>>> >>>> >>>> Den tors 24 jan. 2019 kl 13:19 skrev Maurya Allimuthu < >>>> [email protected]>: >>>> >>>>> 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 serializers.ValidationError("Those passwords don't match.") >>>>> return attrs >>>>> >>>>> OR >>>>> >>>>> >>>>> class Meta: >>>>> model = ********* >>>>> fields = ('***', ) >>>>> validators = [ >>>>> trigger_validator >>>>> ] >>>>> >>>>> >>>>> Thanks, >>>>> Maurya >>>>> >>>>> -- >>>>> 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 [email protected]. >>>>> To post to this group, send email to [email protected]. >>>>> Visit this group at https://groups.google.com/group/django-users. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/django-users/ef2204c4-eed2-411c-a157-d8e1d1d63744%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/django-users/ef2204c4-eed2-411c-a157-d8e1d1d63744%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> -- >>>> 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 [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at https://groups.google.com/group/django-users. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/django-users/CAK4qSCcnMq6jGwToc8cw4EZ1Ksg5pA-1g5KawF26R2AwB%3DXaAw%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/django-users/CAK4qSCcnMq6jGwToc8cw4EZ1Ksg5pA-1g5KawF26R2AwB%3DXaAw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- >>> 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 [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at https://groups.google.com/group/django-users. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/CAEqjY81wfmvchoQcNvz0G2s7mR2vk2B17-KA1XSLiLv%3D4Cnk%2Bg%40mail.gmail.com >>> <https://groups.google.com/d/msgid/django-users/CAEqjY81wfmvchoQcNvz0G2s7mR2vk2B17-KA1XSLiLv%3D4Cnk%2Bg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> 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 [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CAK4qSCdkwXA5FGcm64jhxJFF1e8%3D02OMtYvxBVdJhqbtiFZMbA%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CAK4qSCdkwXA5FGcm64jhxJFF1e8%3D02OMtYvxBVdJhqbtiFZMbA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAEqjY81koyeN%2BQx%3DZ9pVV5PHtydPYbrUj0Tr6P3Ug-vwXr6pqw%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAEqjY81koyeN%2BQx%3DZ9pVV5PHtydPYbrUj0Tr6P3Ug-vwXr6pqw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPzXNr80f4gCavv4cfxCnuds4tpj29g_6vQqvatRLOKkd2935A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

