mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 08:29:59 +03:00
Use PEP 8 compliant import
This commit is contained in:
parent
4be3c02e83
commit
e1c5c761bb
|
@ -65,7 +65,7 @@ Once you've set up a database and the initial user is created and ready to go, o
|
||||||
|
|
||||||
First up we're going to define some serializers. Let's create a new module named `tutorial/quickstart/serializers.py` that we'll use for our data representations.
|
First up we're going to define some serializers. Let's create a new module named `tutorial/quickstart/serializers.py` that we'll use for our data representations.
|
||||||
|
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth.models import Group, User
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,10 +86,10 @@ Notice that we're using hyperlinked relations in this case with `HyperlinkedMode
|
||||||
|
|
||||||
Right, we'd better write some views then. Open `tutorial/quickstart/views.py` and get typing.
|
Right, we'd better write some views then. Open `tutorial/quickstart/views.py` and get typing.
|
||||||
|
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth.models import Group, User
|
||||||
from rest_framework import viewsets
|
from rest_framework import permissions, viewsets
|
||||||
from rest_framework import permissions
|
|
||||||
from tutorial.quickstart.serializers import UserSerializer, GroupSerializer
|
from tutorial.quickstart.serializers import GroupSerializer, UserSerializer
|
||||||
|
|
||||||
|
|
||||||
class UserViewSet(viewsets.ModelViewSet):
|
class UserViewSet(viewsets.ModelViewSet):
|
||||||
|
@ -119,6 +119,7 @@ Okay, now let's wire up the API URLs. On to `tutorial/urls.py`...
|
||||||
|
|
||||||
from django.urls import include, path
|
from django.urls import include, path
|
||||||
from rest_framework import routers
|
from rest_framework import routers
|
||||||
|
|
||||||
from tutorial.quickstart import views
|
from tutorial.quickstart import views
|
||||||
|
|
||||||
router = routers.DefaultRouter()
|
router = routers.DefaultRouter()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user