mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-25 19:14:01 +03:00
Pagination images
This commit is contained in:
parent
53716f6152
commit
1d4956f616
BIN
docs/img/cursor-pagination.png
Normal file
BIN
docs/img/cursor-pagination.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
docs/img/pages-pagination.png
Normal file
BIN
docs/img/pages-pagination.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
|
@ -2,6 +2,17 @@
|
||||||
|
|
||||||
The 3.1 release is an intermediate step in the Kickstarter project releases, and includes a range of new functionality.
|
The 3.1 release is an intermediate step in the Kickstarter project releases, and includes a range of new functionality.
|
||||||
|
|
||||||
|
Some highlights include:
|
||||||
|
|
||||||
|
* A super-smart cursor pagination scheme.
|
||||||
|
* An improved pagination API, supporting header or in-body pagination styles.
|
||||||
|
* Pagination controls rendering in the browsable API.
|
||||||
|
* Better support for API versioning.
|
||||||
|
* Built-in internalization support.
|
||||||
|
* Support for Django 1.8's `HStoreField` and `ArrayField`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Pagination
|
## Pagination
|
||||||
|
|
||||||
The pagination API has been improved, making it both easier to use, and more powerful.
|
The pagination API has been improved, making it both easier to use, and more powerful.
|
||||||
|
@ -14,13 +25,13 @@ The cursor based pagination scheme is particularly smart, and is a better approa
|
||||||
|
|
||||||
#### Pagination controls in the browsable API.
|
#### Pagination controls in the browsable API.
|
||||||
|
|
||||||
Paginated results now include controls that render directly in the browsable API. If you're using the page or limit/offset style, then you'll see a page based control displayed in the browsable API.
|
Paginated results now include controls that render directly in the browsable API. If you're using the page or limit/offset style, then you'll see a page based control displayed in the browsable API:
|
||||||
|
|
||||||
**IMAGE**
|
![page number based pagination](../img/pages-pagination.png )
|
||||||
|
|
||||||
The cursor based pagination renders a more simple 'Previous'/'Next' control.
|
The cursor based pagination renders a more simple style of control:
|
||||||
|
|
||||||
**IMAGE**
|
![cursor based pagination](../img/cursor-pagination.png )
|
||||||
|
|
||||||
#### Support for header-based pagination.
|
#### Support for header-based pagination.
|
||||||
|
|
||||||
|
@ -28,6 +39,8 @@ The pagination API was previously only able to alter the pagination style in the
|
||||||
|
|
||||||
For more information, see the [custom pagination styles](../api-guide/pagination/#custom-pagination-styles) documentation.
|
For more information, see the [custom pagination styles](../api-guide/pagination/#custom-pagination-styles) documentation.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
We've made it easier to build versioned APIs. Built-in schemes for versioning include both URL based and Accept header based variations.
|
We've made it easier to build versioned APIs. Built-in schemes for versioning include both URL based and Accept header based variations.
|
||||||
|
@ -54,6 +67,8 @@ The output representation would match the version used on the incoming request.
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Internationalization
|
## Internationalization
|
||||||
|
|
||||||
REST framework now includes a built-in set of translations, and supports internationalized error responses. This allows you to either change the default language, or to allow clients to specify the language via the `Accept-Language` header.
|
REST framework now includes a built-in set of translations, and supports internationalized error responses. This allows you to either change the default language, or to allow clients to specify the language via the `Accept-Language` header.
|
||||||
|
@ -103,6 +118,8 @@ For more details, see the [internationalization documentation](internationalizat
|
||||||
|
|
||||||
Many thanks to [Craig Blaszczyk](https://github.com/jakul) for helping push this through.
|
Many thanks to [Craig Blaszczyk](https://github.com/jakul) for helping push this through.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## New field types
|
## New field types
|
||||||
|
|
||||||
Django 1.8's new `ArrayField`, `HStoreField` and `UUIDField` are now all fully supported.
|
Django 1.8's new `ArrayField`, `HStoreField` and `UUIDField` are now all fully supported.
|
||||||
|
@ -113,12 +130,16 @@ If you're building a new 1.8 project, then you should probably consider using `U
|
||||||
|
|
||||||
http://example.org/api/purchases/9b1a433f-e90d-4948-848b-300fdc26365d
|
http://example.org/api/purchases/9b1a433f-e90d-4948-848b-300fdc26365d
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## ModelSerializer API
|
## ModelSerializer API
|
||||||
|
|
||||||
The serializer redesign in 3.0 did not include any public API for modifying how ModelSerializer classes automatically generate a set of fields from a given mode class. We've now re-introduced an API for this, allowing you to create new ModelSerializer base classes that behave differently, such as using a different default style for relationships.
|
The serializer redesign in 3.0 did not include any public API for modifying how ModelSerializer classes automatically generate a set of fields from a given mode class. We've now re-introduced an API for this, allowing you to create new ModelSerializer base classes that behave differently, such as using a different default style for relationships.
|
||||||
|
|
||||||
For more information, see the documentation on [customizing field mappings](../api-guide/serializers/#customizing-field-mappings) for ModelSerializer classes.
|
For more information, see the documentation on [customizing field mappings](../api-guide/serializers/#customizing-field-mappings) for ModelSerializer classes.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Moving packages out of core
|
## Moving packages out of core
|
||||||
|
|
||||||
We've now moved a number of packages out of the core of REST framework, and into separately installable packages. If you're currently using these you don't need to worry, you simply need to `pip install` the new packages, and change any import paths.
|
We've now moved a number of packages out of the core of REST framework, and into separately installable packages. If you're currently using these you don't need to worry, you simply need to `pip install` the new packages, and change any import paths.
|
||||||
|
@ -150,7 +171,9 @@ And modify your settings, like so:
|
||||||
|
|
||||||
Thanks go to the latest member of our maintenance team, [José Padilla](https://github.com/jpadilla/), for handling this work and taking on ownership of these packages.
|
Thanks go to the latest member of our maintenance team, [José Padilla](https://github.com/jpadilla/), for handling this work and taking on ownership of these packages.
|
||||||
|
|
||||||
# What's next?
|
---
|
||||||
|
|
||||||
|
## What's next?
|
||||||
|
|
||||||
The next focus will be on HTML renderings of API output and will include:
|
The next focus will be on HTML renderings of API output and will include:
|
||||||
|
|
||||||
|
|
|
@ -186,6 +186,10 @@ body{
|
||||||
margin-top: 15px
|
margin-top: 15px
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#main-content img {
|
||||||
|
display: block;
|
||||||
|
margin: 40px auto;
|
||||||
|
}
|
||||||
/* custom navigation styles */
|
/* custom navigation styles */
|
||||||
|
|
||||||
.navbar .navbar-inner{
|
.navbar .navbar-inner{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user