Use PEP 8 compliant import

This commit is contained in:
Géry Ogam 2022-07-25 11:57:54 +02:00 committed by GitHub
parent 4be3c02e83
commit e1c5c761bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()