1. Jesper Noehr
  2. django-piston
  3. Issues
Issue #74 new

Follow Foreignkeys backwards

shorbaji
created an issue

A related field included within the fields a handler is currently emitted as a RelatedManager object. Ideally, this would be followed back.

One way to possibly achieve this is by adding the following to: piston.Emmitter.construct(self):-

elif hasattr(thing, 'all'): ret = _related(thing, fields)

Comments (2)

  1. Anonymous

    This would be a really great improvement, since at the moment, you have to inject related sets manually…

  2. David Wolever

    One workaround for this is explicitly specifying the related fields to serialize.

    For example:

        fields = (…, ('related_set', ('id', 'some_field', …)), …)
    

    It would be nice, though, if this wasn't necessary…

  3. Log in to comment