Object handler fields override local field list

vezult avatarvezult created an issue

When defining a handler for one object that relates to another, any field that references an object with a handler defined are overridden by the referenced object's handler.

class HandlerFoo(BaseHandler):
    model = Foo

class HandlerBar(BaseHandler):
    model = Bar
    fields = ('blah', ('foo', 'zing', 'zang'))

Assuing 'foo' is a foreign key referencing a 'Foo' object, When the response for HandlerBar is rendered, all the fields on Foo are rendered, even though I specifed only the 'zing' and 'zang' fields.

Local field specs should always have precedence over the field spec on other handlers.

The attached patch changes the precedence.

Comments (5)

  1. Fabian Sturm

    I recently upgraded to Django 1.4 and Piston 7c90898072ce (for 1.4 compatibility) and ran into the same problem. I just applied the patch from above and everything seems to be working again.

    So my question is, will this patch be applied sometimes, or is there any other way I can get the "old" behaviour back?

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.