Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a paramter to disable deep objects in output #259

Closed
wants to merge 2 commits into from

Conversation

B4dM4n
Copy link

@B4dM4n B4dM4n commented Oct 21, 2013

Add the parameter exclude_all_relations to create_api_blueprint, which disables deep object queries when True.
This also disables relations included with include_columns.

@jfinkels
Copy link
Owner

jfinkels commented Dec 1, 2013

This needs a test case, and needs to be documented in docs/customizing.rst before I can merge it.

@B4dM4n
Copy link
Author

B4dM4n commented Jul 23, 2014

I discontinued using this form of exluding relations, because it doesn't allow to include specific ones.
My solution for now is a simple wrapper like this:

def create_api(manager, model, exclude_relations=False, **kwargs):
  from flask.ext.restless.helpers import get_relations

  if exclude_relations:
    if 'include_columns' in kwargs:
      app.logger.warning('include_columns is set, but exclude_relations is True for %s', model)
    else:
      kwargs.setdefault('exclude_columns', []).extend(get_relations(model))
  manager.create_api(model, **kwargs)

@B4dM4n B4dM4n closed this Jul 23, 2014
@B4dM4n B4dM4n deleted the exclude_all_relations branch July 23, 2014 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants