Hi,

It’s a bit more complex than that.

Content négociation along with renderers and parsers will move the data from 
the HTTP body into basic python types (int / floats / strings).
Serializers will move those basic types from and to more complex ones 
(DateTimes, Decimals, Django models / querysets).

hopes this will help.

Regards,
Xavier,
Linovia.

> Le 30 oct. 2018 à 16:55, 'enricoba' via Django REST framework 
> <[email protected]> a écrit :
> 
> Hi, 
> 
> I am fairly new to Django REST framework, but mid experienced with native 
> Django. First I have a basic question regarding serializers (see picture - 
> using the REST framework tutorial info). For my understanding the serializer 
> transforms a Django queryset into a „readable“ JSON. Therefore, I am not sure 
> what is happening in step 7 and 8 (hoping my assumptions are correct). Is the 
> serializer defining which fields of the querysets shall be serialized? So I 
> don‘t know why it has to look into Models again.
> 
> Beside of this general question, I have a special setup of data. In addition 
> to storing raw data, I store hash strings of my payload in each record (own 
> field "checksum"). I do this to notice data manipulation on database level 
> (there is a pepper from the application layer included). However, I would 
> like to add a custom field to all of my API calls that provides a bool 
> telling that the payload was not manipulated (compare payload + pepper with 
> hash). As from what I have learned until now, I could do this by adding a 
> custom field to the Model that I can call via the serializer. Unfortunately, 
> when doing so I only can access the Model object, not the Manager of the 
> Model. Therefore, I can only explicitly call model fields, but not generic. 
> Now my question is if this is even the correct point of access? Or should / 
> can I deal with this on the view level?
> 
> Thanks for any advice!
> <RESTapi.png>
> 
> 
> 
> -- 
> 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 [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> <RESTapi.png>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to