google-code-export / wadofstuff

Automatically exported from code.google.com/p/wadofstuff
1 stars 0 forks source link

Serialisation of reverse FK and M2M lookups #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I posted a comment on your blog and went away to come up with a decent
suggestion.

What steps will reproduce the problem?
1. M2M fields defined on a related object aren't serialised

I've attached a patch that looks up any FK or M2M defined on related models
and, if specified in 'relations' serialises them. You should be able to
pass in options as with regular M2M and FK lookups.

e.g. for a theoretica blog api
serializers.serialize('json', Post.objects.all(), indent=4,
relations=('comment_set',))

Please contact me if you'd like to discuss or would prefer full .py files
to work with.

Original issue reported on code.google.com by stur...@gmail.com on 17 Mar 2009 at 5:14

Attachments:

GoogleCodeExporter commented 9 years ago
I've improved the serializers' handling of reverse and recursive Foreign Key 
lookups.

Please disreqard the above patch and use the new one.

This is a patch to be applied to the 'serializers' directory.

Thanks!

Original comment by stur...@gmail.com on 7 Apr 2009 at 4:58

Attachments:

GoogleCodeExporter commented 9 years ago
Any chance to get the patch into svn trunk?

Original comment by munhi...@gmail.com on 14 Jul 2009 at 9:10

GoogleCodeExporter commented 9 years ago
Yes any chance of getting the patch into the svn trunk?

Original comment by mark.el...@gmail.com on 15 Jul 2009 at 3:05

GoogleCodeExporter commented 9 years ago
Its possible to send me de full .py file?

Original comment by frederic...@gmail.com on 28 May 2010 at 6:58

GoogleCodeExporter commented 9 years ago
I would appreciate the .py files as well. Looks like a great patch!

Original comment by Martin.R...@gmail.com on 1 Jun 2010 at 7:45

GoogleCodeExporter commented 9 years ago
No problem - Frederico indicates that the patch still works on 1.2 with the 
latest
wadofstuff serializers so I can send those to you. I should really set up a 
full app
for this. :)

Original comment by stur...@gmail.com on 1 Jun 2010 at 12:32

GoogleCodeExporter commented 9 years ago
These files should just replace the existing files. Please let me know if they 
fail
on your install.

Original comment by ric...@gmail.com on 4 Jun 2010 at 8:54

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Did this patch ever make into svn or pypi? I'd like to use it in various 
deployments, so being able to get it with pip would be cool.

Original comment by robert...@gmail.com on 24 Apr 2011 at 2:51

GoogleCodeExporter commented 9 years ago
Same here. Would like to see it included as well. I'm totally abusing this 
great serializer and this is something which is confusing me.

Original comment by cont...@roelkramer.nl on 25 May 2011 at 6:03

GoogleCodeExporter commented 9 years ago
I applied the patch to version 1.1.0 (Available in pip). Thanks to sturton.

Original comment by cont...@roelkramer.nl on 27 May 2011 at 11:50

Attachments:

GoogleCodeExporter commented 9 years ago
I don't know how to install this patch?Coudl you tell me the detailed?(my 
django app is used in windows xp)

Original comment by yanqing6...@gmail.com on 18 Jul 2011 at 1:35

GoogleCodeExporter commented 9 years ago
Has this been integrated yet. Its a show-stopper bug :(

Original comment by shayne.oneill@gmail.com on 23 Feb 2012 at 8:32

GoogleCodeExporter commented 9 years ago
Thank you!

Original comment by yuch...@gmail.com on 25 Apr 2014 at 1:33