old_contents: from drinks.models import Drink, Ingredient
  from drinks.serializers import DrinkSerializer, IngredientSerializer
  from drinks.permissions import IsOwnerOrReadOnly
  
  from rest_framework import generics
  from rest_framework import permissions
  
  
  # class based views
  class DrinkList(generics.ListCreateAPIView):
      permission_classes = (permissions.IsAuthenticatedOrReadOnly, )
      queryset = Drink.objects.all()
      serializer_class = DrinkSerializer
  
      def perform_create(self, serializer):
          serializer.save(owner=self.request.user)
  
  
  class IngredientList(generics.ListAPIView):
      permission_classes = (permissions.IsAuthenticatedOrReadOnly, )
      queryset = Ingredient.objects.all()
      serializer_class = IngredientSerializer
  
      def perform_create(self, serializer):
          serializer.save(owner=self.request.user)
  
  
  class DrinkDetail(generics.RetrieveUpdateDestroyAPIView):
      permission_classes = (permissions.IsAuthenticatedOrReadOnly,
                            IsOwnerOrReadOnly)
      queryset = Drink.objects.all()
      serializer_class = DrinkSerializer
  
new_contents: from drinks.models import Drink, Ingredient
  from drinks.serializers import DrinkSerializer, IngredientSerializer
  from drinks.permissions import IsOwnerOrReadOnly
  
  from rest_framework import generics
  from rest_framework import permissions
  
  from django.template.response import TemplateResponse
  
  
  # class based views
  class DrinkList(generics.ListCreateAPIView):
      permission_classes = (permissions.IsAuthenticatedOrReadOnly, )
      queryset = Drink.objects.all()
      serializer_class = DrinkSerializer
  
      def perform_create(self, serializer):
          serializer.save(owner=self.request.user)
  
  
  class IngredientList(generics.ListAPIView):
      permission_classes = (permissions.IsAuthenticatedOrReadOnly, )
      queryset = Ingredient.objects.all()
      serializer_class = IngredientSerializer
  
      def perform_create(self, serializer):
          serializer.save(owner=self.request.user)
  
  
  class DrinkDetail(generics.RetrieveUpdateDestroyAPIView):
      permission_classes = (permissions.IsAuthenticatedOrReadOnly,
                            IsOwnerOrReadOnly)
      queryset = Drink.objects.all()
      serializer_class = DrinkSerializer
  
  
  # return index.html from template
  def render_index(request):
      return TemplateResponse(request, 'index.html')
  
subject: Add index template