mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Merge remote-tracking branch 'reference/stable/3.3.x' into stable/3.3.3
This commit is contained in:
commit
97cc83483f
|
@ -143,7 +143,7 @@ Your URL conf must include a pattern that matches the version with a `'version'`
|
|||
|
||||
## NamespaceVersioning
|
||||
|
||||
To the client, this scheme is the same as `URLParameterVersioning`. The only difference is how it is configured in your Django application, as it uses URL namespacing, instead of URL keyword arguments.
|
||||
To the client, this scheme is the same as `URLPathVersioning`. The only difference is how it is configured in your Django application, as it uses URL namespacing, instead of URL keyword arguments.
|
||||
|
||||
GET /v1/something/ HTTP/1.1
|
||||
Host: example.com
|
||||
|
@ -165,7 +165,7 @@ In the following example we're giving a set of views two different possible URL
|
|||
url(r'^v2/bookings/', include('bookings.urls', namespace='v2'))
|
||||
]
|
||||
|
||||
Both `URLParameterVersioning` and `NamespaceVersioning` are reasonable if you just need a simple versioning scheme. The `URLParameterVersioning` approach might be better suitable for small ad-hoc projects, and the `NamespaceVersioning` is probably easier to manage for larger projects.
|
||||
Both `URLPathVersioning` and `NamespaceVersioning` are reasonable if you just need a simple versioning scheme. The `URLPathVersioning` approach might be better suitable for small ad-hoc projects, and the `NamespaceVersioning` is probably easier to manage for larger projects.
|
||||
|
||||
## HostNameVersioning
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ Right now we have endpoints for 'snippets' and 'users', but we don't have a sing
|
|||
from rest_framework.reverse import reverse
|
||||
|
||||
|
||||
@api_view(('GET',))
|
||||
@api_view(['GET'])
|
||||
def api_root(request, format=None):
|
||||
return Response({
|
||||
'users': reverse('user-list', request=request, format=format),
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authtoken', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='token',
|
||||
options={'verbose_name_plural': 'Tokens', 'verbose_name': 'Token'},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='token',
|
||||
name='created',
|
||||
field=models.DateTimeField(verbose_name='Created', auto_now_add=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='token',
|
||||
name='key',
|
||||
field=models.CharField(verbose_name='Key', max_length=40, primary_key=True, serialize=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='token',
|
||||
name='user',
|
||||
field=models.OneToOneField(to=settings.AUTH_USER_MODEL, verbose_name='User', related_name='auth_token'),
|
||||
),
|
||||
]
|
Loading…
Reference in New Issue
Block a user