from django.shortcuts import render # Create your views here. import django.views.generic from django.http import JsonResponse from django.urls import reverse from rest_framework import authentication, permissions, status, viewsets import rest_framework.generics from rest_framework.response import Response from rest_framework.views import APIView import recipe.models import recipe.serializers class RecipeAPI(rest_framework.generics.RetrieveUpdateAPIView): # authentication_classes = (authentication.TokenAuthentication, # authentication.SessionAuthentication, # authentication.BasicAuthentication) # permission_classes = (permissions.IsAuthenticated,) queryset = recipe.models.Recipe.objects.all() serializer_class = recipe.serializers.RecipeSerializer class RecipeListAPI(rest_framework.generics.ListAPIView, rest_framework.generics.CreateAPIView): # authentication_classes = (authentication.TokenAuthentication, # authentication.SessionAuthentication, # authentication.BasicAuthentication) # permission_classes = (permissions.IsAuthenticated,) queryset = recipe.models.Recipe.objects.all() serializer_class = recipe.serializers.RecipeSerializer