Hi Mike,

On Fri, 4 Aug 2023, at 06:03, Ryan Gartin wrote:
> I came across this issue calling the following and FK fields with _id are 
> ignored:
> serialize('json', ...., fields=['title', 'state_id']). 

I think the problem you've run into here is "state_id" is not a Field on your 
model; it's where the raw PK value for your ForeignKey is stored.

I've just double checked the code for serialize, and I'm pretty sure the 
default behavior for a ForeignKey field _is_ _already_ to output the PK value.

What happens in your code if you put "state" instead of "state_id" in the field 
list?

--
Curtis

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/99bd4b70-9f98-4f9d-a3d5-23c5d965b223%40app.fastmail.com.

Reply via email to