From 323f59091c83f777cb6c9919d502055ac79ca8cb Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Thu, 16 Mar 2017 09:03:45 -0400 Subject: [PATCH 01/13] add content block and breadcrumbs_empty block to allow base.html to be reused --- rest_framework/templates/rest_framework/base.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html index ef9b026c8..bd87ba8a6 100644 --- a/rest_framework/templates/rest_framework/base.html +++ b/rest_framework/templates/rest_framework/base.html @@ -63,12 +63,15 @@ {% else %}
  • {{ breadcrumb_name }}
  • {% endif %} + {% empty %} + {% block breadcrumbs_empty %} {% endblock breadcrumbs_empty %} {% endfor %} {% endblock %}
    + {% block content %} {% if 'GET' in allowed_methods %}
    @@ -252,6 +255,7 @@
    {% endif %} {% endif %} + {% endblock content %} From 9c3edb092178efad39e63af2bc82f04ae708ce64 Mon Sep 17 00:00:00 2001 From: sol HYUN Date: Sat, 18 Mar 2017 04:50:01 +0900 Subject: [PATCH 02/13] DEFAULT_PAGINATION_CLASS is changed to 'None' because the default value was specified, it did not work properly in API Document --- rest_framework/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/settings.py b/rest_framework/settings.py index b699d7caf..f7d9a0919 100644 --- a/rest_framework/settings.py +++ b/rest_framework/settings.py @@ -50,7 +50,7 @@ DEFAULTS = { 'DEFAULT_VERSIONING_CLASS': None, # Generic view behavior - 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', + 'DEFAULT_PAGINATION_CLASS': None, 'DEFAULT_FILTER_BACKENDS': (), # Throttling From 16aad894592e17965371806d0550f82b22ccee76 Mon Sep 17 00:00:00 2001 From: sol HYUN Date: Sat, 18 Mar 2017 06:01:08 +0900 Subject: [PATCH 03/13] reverted to fix the issue without changing setting --- rest_framework/schemas.py | 3 ++- rest_framework/settings.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rest_framework/schemas.py b/rest_framework/schemas.py index ecfe835a9..98dd37207 100644 --- a/rest_framework/schemas.py +++ b/rest_framework/schemas.py @@ -600,7 +600,8 @@ class SchemaGenerator(object): if not is_list_view(path, method, view): return [] - if not getattr(view, 'pagination_class', None): + pagination = getattr(view, 'pagination_class', None) + if not pagination or not pagination.page_size: return [] paginator = view.pagination_class() diff --git a/rest_framework/settings.py b/rest_framework/settings.py index f7d9a0919..b699d7caf 100644 --- a/rest_framework/settings.py +++ b/rest_framework/settings.py @@ -50,7 +50,7 @@ DEFAULTS = { 'DEFAULT_VERSIONING_CLASS': None, # Generic view behavior - 'DEFAULT_PAGINATION_CLASS': None, + 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', 'DEFAULT_FILTER_BACKENDS': (), # Throttling From 7e76cd8695dbbe40b4a7c3209038fdf0ab8fedaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Padilla?= Date: Fri, 17 Mar 2017 20:27:36 -0400 Subject: [PATCH 04/13] Correctly set scheme in coreapi TokenAuthentication --- rest_framework/static/rest_framework/docs/js/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/static/rest_framework/docs/js/api.js b/rest_framework/static/rest_framework/docs/js/api.js index 131c7f814..cac67efbb 100644 --- a/rest_framework/static/rest_framework/docs/js/api.js +++ b/rest_framework/static/rest_framework/docs/js/api.js @@ -163,7 +163,7 @@ $('form.api-interaction').submit(function(event) { if (window.auth && window.auth.type === 'token') { // Header authentication options.auth = new coreapi.auth.TokenAuthentication({ - prefix: window.auth.scheme, + scheme: window.auth.scheme, token: window.auth.token }) } else if (window.auth && window.auth.type === 'basic') { From be0e196e65cf50ab8be1e6aa8d56e5f4d13def7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Padilla?= Date: Fri, 17 Mar 2017 21:43:20 -0400 Subject: [PATCH 05/13] Remove unused base.js script --- .../static/rest_framework/docs/js/base.js | 42 ------------------- 1 file changed, 42 deletions(-) delete mode 100644 rest_framework/static/rest_framework/docs/js/base.js diff --git a/rest_framework/static/rest_framework/docs/js/base.js b/rest_framework/static/rest_framework/docs/js/base.js deleted file mode 100644 index 081650cff..000000000 --- a/rest_framework/static/rest_framework/docs/js/base.js +++ /dev/null @@ -1,42 +0,0 @@ -function getSearchTerm() -{ - var sPageURL = window.location.search.substring(1); - var sURLVariables = sPageURL.split('&'); - for (var i = 0; i < sURLVariables.length; i++) - { - var sParameterName = sURLVariables[i].split('='); - if (sParameterName[0] == 'q') - { - return sParameterName[1]; - } - } -} - -$(document).ready(function() { - - var search_term = getSearchTerm(), - $search_modal = $('#mkdocs_search_modal'); - - if(search_term){ - $search_modal.modal(); - } - - // make sure search input gets autofocus everytime modal opens. - $search_modal.on('shown.bs.modal', function () { - $search_modal.find('#mkdocs-search-query').focus(); - }); - - // Highlight.js - hljs.initHighlightingOnLoad(); - $('table').addClass('table table-striped table-hover'); -}); - - -$('body').scrollspy({ - target: '.bs-sidebar', -}); - -/* Prevent disabled links from causing a page reload */ -$("li.disabled a").click(function() { - event.preventDefault(); -}); From d8507d3f9c9781f24f225d63894842e0769198c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Padilla?= Date: Fri, 17 Mar 2017 21:44:11 -0400 Subject: [PATCH 06/13] Move bootstrap modal data attrs to anchor --- rest_framework/templates/rest_framework/docs/sidebar.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rest_framework/templates/rest_framework/docs/sidebar.html b/rest_framework/templates/rest_framework/docs/sidebar.html index 452d5c20f..c6ac26f66 100644 --- a/rest_framework/templates/rest_framework/docs/sidebar.html +++ b/rest_framework/templates/rest_framework/docs/sidebar.html @@ -22,10 +22,10 @@ Authentication {% if user.is_authenticated %}session{% else %}none{% endif %}