Commit 6ad0be44 by Xavier Ordoquy

Merge remote-tracking branch 'reference/master' into feature/improve_schema_shortcut

* reference/master:
  use django 1.11rc1 in tox
  Leave parameters with regex pattern as String
  restored original formatting
  Do not hint BigAutoField as integer (outside of range)
  Mention where the mixins live
  Try to improve browser support
  Cleanup and refactor docs api.js script
  Move bootstrap modal data attrs to anchor
  Remove unused base.js script
  Correctly set scheme in coreapi TokenAuthentication
  reverted to fix the issue without changing setting
  DEFAULT_PAGINATION_CLASS is changed to 'None'
  add content block and breadcrumbs_empty block to allow base.html to be reused
  Update 7-schemas-and-client-libraries.md
  Updated testimonial name on funding site
  ID must start from 1 again
parents b558c9ec 0fdaf4f4
......@@ -235,6 +235,8 @@ You may need to provide custom `ViewSet` classes that do not have the full set o
To create a base viewset class that provides `create`, `list` and `retrieve` operations, inherit from `GenericViewSet`, and mixin the required actions:
from rest_framework import mixins
class CreateListRetrieveViewSet(mixins.CreateModelMixin,
mixins.ListModelMixin,
mixins.RetrieveModelMixin,
......
......@@ -147,7 +147,7 @@ Sign up for a paid plan today, and help ensure that REST framework becomes a sus
> It's really awesome that this project continues to endure. The code base is top notch and the maintainers are committed to the highest level of quality.
DRF is one of the core reasons why Django is top choice among web frameworks today. In my opinion, it sets the standard for rest frameworks for the development community at large.
>
> — agconti, Django REST framework user
> — Andrew Conti, Django REST framework user
---
......
......@@ -209,7 +209,7 @@ We can make a successful request by including the username and password of one o
http -a tom:password123 POST http://127.0.0.1:8000/snippets/ code="print 789"
{
"id": 5,
"id": 1,
"owner": "tom",
"title": "foo",
"code": "print 789",
......
......@@ -41,7 +41,7 @@ view in our URL configuration.
schema_view = get_schema_view(title='Pastebin API')
urlpatterns = [
url('^schema/$', schema_view),
       url(r'^schema/$', schema_view),
...
]
......
......@@ -526,6 +526,7 @@ class SchemaGenerator(object):
title = ''
description = ''
schema_cls = coreschema.String
kwargs = {}
if model is not None:
# Attempt to infer a field description if possible.
try:
......@@ -541,14 +542,16 @@ class SchemaGenerator(object):
elif model_field is not None and model_field.primary_key:
description = get_pk_description(model, model_field)
if isinstance(model_field, models.AutoField):
if hasattr(view, 'lookup_value_regex') and view.lookup_field == variable:
kwargs['pattern'] = view.lookup_value_regex
elif isinstance(model_field, models.AutoField):
schema_cls = coreschema.Integer
field = coreapi.Field(
name=variable,
location='path',
required=True,
schema=schema_cls(title=title, description=description)
schema=schema_cls(title=title, description=description, **kwargs)
)
fields.append(field)
......@@ -600,7 +603,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()
......
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();
});
......@@ -63,12 +63,15 @@
{% else %}
<li><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
{% endif %}
{% empty %}
{% block breadcrumbs_empty %}&nbsp;{% endblock breadcrumbs_empty %}
{% endfor %}
</ul>
{% endblock %}
<!-- Content -->
<div id="content">
{% block content %}
{% if 'GET' in allowed_methods %}
<form id="get-form" class="pull-right">
......@@ -252,6 +255,7 @@
</div>
{% endif %}
{% endif %}
{% endblock content %}
</div><!-- /.content -->
</div><!-- /.container -->
</div><!-- ./wrapper -->
......
......@@ -22,10 +22,10 @@
<a><i class="fa fa-user fa-lg"></i> Authentication</a> <span id="selected-authentication">{% if user.is_authenticated %}session{% else %}none{% endif %}</span>
</li>
<ul class="sub-menu collapse out" id="auth-control">
<li data-auth="none" {% if not user.is_authenticated %}class="active"{% endif %}><a href="#" data-language="none">none</a></li>
<li data-auth="token" data-toggle="modal" data-target="#auth_token_modal"><a href="#">token</a></li>
<li data-auth="basic" data-toggle="modal" data-target="#auth_basic_modal"><a href="#">basic</a></li>
<li data-auth="session" data-toggle="modal" data-target="#auth_session_modal" {% if user.is_authenticated %}class="active"{% endif %}><a href="#">session</a></li>
<li {% if not user.is_authenticated %}class="active"{% endif %}><a data-auth="none" href="#">none</a></li>
<li><a data-auth="token" data-toggle="modal" data-target="#auth_token_modal" href="#">token</a></li>
<li><a data-auth="basic" data-toggle="modal" data-target="#auth_basic_modal" href="#">basic</a></li>
<li {% if user.is_authenticated %}class="active"{% endif %}><a data-auth="session" data-toggle="modal" data-target="#auth_session_modal" href="#">session</a></li>
</ul>
<li data-toggle="collapse" data-target="#language-control" class="collapsed">
......
......@@ -26,7 +26,7 @@ deps =
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10
django110: Django>=1.10,<1.11
django111: Django>=1.11b1,<2.0
django111: Django>=1.11rc1,<2.0
djangomaster: https://github.com/django/django/archive/master.tar.gz
-rrequirements/requirements-testing.txt
-rrequirements/requirements-optionals.txt
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment