mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-10-31 07:57:55 +03:00 
			
		
		
		
	Update documentation
This commit is contained in:
		
							parent
							
								
									64c44bf357
								
							
						
					
					
						commit
						09d51ea4e2
					
				|  | @ -539,7 +539,7 @@ class StandardResultsSetPagination(PageNumberPagination): | ||||||
| } | } | ||||||
| </code></pre> | </code></pre> | ||||||
| <h4 id="setup_1">Setup</h4> | <h4 id="setup_1">Setup</h4> | ||||||
| <p>To enable the <code>PageNumberPagination</code> style globally, use the following configuration:</p> | <p>To enable the <code>LimitOffsetPagination</code> style globally, use the following configuration:</p> | ||||||
| <pre><code>REST_FRAMEWORK = { | <pre><code>REST_FRAMEWORK = { | ||||||
|     'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination' |     'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination' | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -498,7 +498,7 @@ request = factory.put('/notes/547/', content, content_type=content_type) | ||||||
| <h2 id="forcing-authentication">Forcing authentication</h2> | <h2 id="forcing-authentication">Forcing authentication</h2> | ||||||
| <p>When testing views directly using a request factory, it's often convenient to be able to directly authenticate the request, rather than having to construct the correct authentication credentials.</p> | <p>When testing views directly using a request factory, it's often convenient to be able to directly authenticate the request, rather than having to construct the correct authentication credentials.</p> | ||||||
| <p>To forcibly authenticate a request, use the <code>force_authenticate()</code> method.</p> | <p>To forcibly authenticate a request, use the <code>force_authenticate()</code> method.</p> | ||||||
| <pre><code>from rest_framework.tests import force_authenticate | <pre><code>from rest_framework.test import force_authenticate | ||||||
| 
 | 
 | ||||||
| factory = APIRequestFactory() | factory = APIRequestFactory() | ||||||
| user = User.objects.get(username='olivia') | user = User.objects.get(username='olivia') | ||||||
|  |  | ||||||
|  | @ -496,7 +496,7 @@ Host: example.org | ||||||
| <hr /> | <hr /> | ||||||
| <h2 id="modelserializer-api">ModelSerializer API</h2> | <h2 id="modelserializer-api">ModelSerializer API</h2> | ||||||
| <p>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.</p> | <p>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.</p> | ||||||
| <p>For more information, see the documentation on <a href="../../../api-guide/serializers.md/#customizing-field-mappings">customizing field mappings</a> for ModelSerializer classes.</p> | <p>For more information, see the documentation on <a href="../../api-guide/serializers#customizing-field-mappings">customizing field mappings</a> for ModelSerializer classes.</p> | ||||||
| <hr /> | <hr /> | ||||||
| <h2 id="moving-packages-out-of-core">Moving packages out of core</h2> | <h2 id="moving-packages-out-of-core">Moving packages out of core</h2> | ||||||
| <p>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 <code>pip install</code> the new packages, and change any import paths.</p> | <p>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 <code>pip install</code> the new packages, and change any import paths.</p> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user