[patch] serializer can't resolve a one-to-many relation from the "foreign" side

1 view
Skip to first unread message

Nikolaus Schlemm

unread,
Oct 4, 2006, 8:19:14 AM10/4/06
to django-d...@googlegroups.com
hi,

in case anybody else has been trying to include one2many-relations when
serializing the "one" side, take a look at

http://code.djangoproject.com/ticket/2843

would be great if someone else could test this as well. thanks!
--
cheers,

Nikl

Michael Radziej

unread,
Oct 4, 2006, 8:39:52 AM10/4/06
to django-d...@googlegroups.com
Hi Nikolaus,

Nikolaus Schlemm schrieb:

It would be easier to comment on it if you would provide a patch
with full path, so that track can recognize its context and
display it properly. Look at the other patches if you don't see how.

I'd like to have a way to control through which foreign key
fields it should expand, since I might not need all the data.
That's also a point with the current implementation: It doesn't
let me skip data fields not needed.

Anyway, how is this supposed to behave for a chain of foreign
keys? Would it go through all the related models and the models
related to the related models, etc.?

Michael


Nikolaus Schlemm

unread,
Oct 4, 2006, 9:03:30 AM10/4/06
to django-d...@googlegroups.com
hi Michael,

> It would be easier to comment on it if you would provide a patch
> with full path, so that track can recognize its context and
> display it properly. Look at the other patches if you don't see how.

after looking at other patches, I now called "svn diff" from the django
root-dir and attached that, but unfortunately trac still won't display it
properly. is there anything else that needs to be done with it?

> I'd like to have a way to control through which foreign key
> fields it should expand, since I might not need all the data.
> That's also a point with the current implementation: It doesn't
> let me skip data fields not needed.

that's a valid point, but possilby an issue of its own. currently, the export
of one2many relations would be controlled by a boolean. but in generally
speaking, I think the fields to be exported could be passed in as a list
parameter..

> Anyway, how is this supposed to behave for a chain of foreign
> keys? Would it go through all the related models and the models
> related to the related models, etc.?

nope, this simply compiles a list of the primary keys of the "many" related
models when you export the "one" - similarly to how many2many relations are
exported.
--
cheers,

Nikl

Nikolaus Schlemm

unread,
Oct 4, 2006, 11:34:26 AM10/4/06
to django-d...@googlegroups.com
> I'd like to have a way to control through which foreign key
> fields it should expand, since I might not need all the data.
> That's also a point with the current implementation: It doesn't
> let me skip data fields not needed.
more and more I'm thinking this is definitely an excellent idea!! e.g. you
wouldn't necessarily want to export password fields ;)
--
cheers,

Nikl

Reply all
Reply to author
Forward
0 new messages