Skip to content

Commit

Permalink
hide grandchildren links by default to make the output cleaner and le…
Browse files Browse the repository at this point in the history
…ss confusing
  • Loading branch information
vsemionov committed Aug 21, 2017
1 parent 6e8ef66 commit 020a891
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,13 @@ class UserLinksSerializer(serializers.Serializer):
lookup_field='username')
notebooks = DynamicHyperlinkedIdentityField(view_name='notebook-list',
lookup_url_kwarg='user_username', lookup_field='username')
notes = DynamicHyperlinkedIdentityField(view_name='note-list',
lookup_url_kwarg='user_username', lookup_field='username')
tasks = DynamicHyperlinkedIdentityField(view_name='task-list',
lookup_url_kwarg='user_username', lookup_field='username')

if settings.API_SHOW_GRANDCHILDREN_LINKS:
notes = DynamicHyperlinkedIdentityField(view_name='note-list',
lookup_url_kwarg='user_username', lookup_field='username')

class DynamicUserSerializer(UserSerializer):
links = UserLinksSerializer(read_only=True, source='*')

Expand Down
1 change: 1 addition & 0 deletions boomerang/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
API_MAX_PAGE_SIZE = 100
API_DELETED_EXPIRY_DAYS = 30
API_SHOW_CHILDREN_IDS = bool(int(os.getenv('API_SHOW_CHILDREN_IDS', 0)))
API_SHOW_GRANDCHILDREN_LINKS = bool(int(os.getenv('API_SHOW_GRANDCHILDREN_LINKS', 0)))


CORS_ALLOW_CREDENTIALS = True
Expand Down

0 comments on commit 020a891

Please sign in to comment.