Re: Feature Request: Allow Serialize Foreign Keys as Ids

2023-08-06 Thread Ryan
Thanks. Would this just be for myself or would it be considered to merge into Django core? On Sat, Aug 5, 2023 at 9:22 PM Curtis Maloney wrote: > On Sat, 5 Aug 2023, at 06:47, Ryan Gartin wrote: > > You are correct state_id is not a field on the model, state is, and using “ > state” in the field

Re: Feature Request: Allow Serialize Foreign Keys as Ids

2023-08-05 Thread Curtis Maloney
On Sat, 5 Aug 2023, at 06:47, Ryan Gartin wrote: > You are correct state_id is not a field on the model, state is, and using > “state” in the field lists works. > > I would like to propose that if ‘state_id’ is a valid property on the > queryset (and in the database) that is should be serialize

Re: Feature Request: Allow Serialize Foreign Keys as Ids

2023-08-05 Thread Vansh NaiK
How toh hack account On Saturday, 5 August 2023 at 02:17:12 UTC+5:30 Ryan Gartin wrote: > You are correct state_id is not a field on the model, state is, and using “ > state” in the field lists works. > > I would like to propose that if ‘state_id’ is a valid property on the > queryset (and in

Re: Feature Request: Allow Serialize Foreign Keys as Ids

2023-08-04 Thread Ryan Gartin
You are correct state_id is not a field on the model, state is, and using “ state” in the field lists works. I would like to propose that if ‘state_id’ is a valid property on the queryset (and in the database) that is should be serialized. It is my preference that a serialized JSON property (to

Re: Feature Request: Allow Serialize Foreign Keys as Ids

2023-08-03 Thread Curtis Maloney
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 wh

Feature Request: Allow Serialize Foreign Keys as Ids

2023-08-03 Thread Ryan Gartin
I came across this issue calling the following and FK fields with _id are ignored: serialize('json', , fields=['title', 'state_id']). State is a ForeignKey on my queryset. I can perform fields=['title', 'state'] and I get serialization correctly of {'state': int}. However, if I specify fie