Hi - thanks, yes, that makes sense, but in following the tutorial I must 
have written something out of order. Have moved past this in the tutorial 
now (using ModelSerializer) but may come back to this.

Thanks for your response.

On Monday, 19 June 2017 15:10:19 UTC+1, Xavier Ordoquy wrote:
>
> Hi,
>
> serializer.data should only be used for serialization.
> If you try to access it during deserialization, you’ll get a warning from 
> the framework:
>
> serializer = SnippetSerializer(snippet)
> serializer.data
>
> or
>
> serializer = SnippetSerializer(data=data)
> serializer.is_valid()serializer.validated_dataserializer.save()
>
> But in the latter case, you can’t call serializer.data (doesn’t make sense 
> either as you provided the data in the first place).
>
> Hopes this helps,
> Xavier Ordoquy,
> Linovia.
>
>
> Le 19 juin 2017 à 16:05, mrlemon <[email protected] <javascript:>> a 
> écrit :
>
> Hi - just come to DRF; exploring for an upcoming project.
>
> Is there an oversight in the tutorial (
> http://www.django-rest-framework.org/tutorial/1-serialization/) or am I 
> doing something wrong?
>
> The framework guards against calling serializer.data,but states that you 
> do so in the tutorial.
>
> I see the issue 
> <https://github.com/encode/django-rest-framework/issues/2490> on this, 
> but it's I'm still getting the error when restarting the shell and 
> following the tutorial without calling serializer.data.
>
> Any advice welcome.
>
>
>
>
>
>
> -- 
> 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] <javascript:>.
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to