from django.shortcuts import render
from rest_framework import generics

from recipes.models import Recipe
from .serializers import RecipeSerializer

class RecipeListCreateAPIView(generics.ListCreateAPIView):
    queryset = Recipe.objects.all()
    serializer_class = RecipeSerializer

    def perform_create(self, serializer):
        serializer.save(created_by=self.request.user)

class MyRecipeListCreateAPIView(generics.ListCreateAPIView):
    # queryset = Recipe.objects.filter(created_by=request.user)
    serializer_class = RecipeSerializer

    def get_queryset(self):
        """
        This view should return a list of all the purchases
        for the currently authenticated user.
        """
        user = self.request.user
        return Recipe.objects.filter(created_by=user)

99f7aa7f88de48f6430d8620410d6b76de41659e
<mask token>


class RecipeListCreateAPIView(generics.ListCreateAPIView):
    <mask token>
    <mask token>
    <mask token>


class MyRecipeListCreateAPIView(generics.ListCreateAPIView):
    serializer_class = RecipeSerializer

    def get_queryset(self):
        """
        This view should return a list of all the purchases
        for the currently authenticated user.
        """
        user = self.request.user
        return Recipe.objects.filter(created_by=user)

<mask token>


class RecipeListCreateAPIView(generics.ListCreateAPIView):
    <mask token>
    <mask token>

    def perform_create(self, serializer):
        serializer.save(created_by=self.request.user)


class MyRecipeListCreateAPIView(generics.ListCreateAPIView):
    serializer_class = RecipeSerializer

    def get_queryset(self):
        """
        This view should return a list of all the purchases
        for the currently authenticated user.
        """
        user = self.request.user
        return Recipe.objects.filter(created_by=user)

<mask token>


class RecipeListCreateAPIView(generics.ListCreateAPIView):
    queryset = Recipe.objects.all()
    serializer_class = RecipeSerializer

    def perform_create(self, serializer):
        serializer.save(created_by=self.request.user)


class MyRecipeListCreateAPIView(generics.ListCreateAPIView):
    serializer_class = RecipeSerializer

    def get_queryset(self):
        """
        This view should return a list of all the purchases
        for the currently authenticated user.
        """
        user = self.request.user
        return Recipe.objects.filter(created_by=user)

from django.shortcuts import render
from rest_framework import generics
from recipes.models import Recipe
from .serializers import RecipeSerializer


class RecipeListCreateAPIView(generics.ListCreateAPIView):
    queryset = Recipe.objects.all()
    serializer_class = RecipeSerializer

    def perform_create(self, serializer):
        serializer.save(created_by=self.request.user)


class MyRecipeListCreateAPIView(generics.ListCreateAPIView):
    serializer_class = RecipeSerializer

    def get_queryset(self):
        """
        This view should return a list of all the purchases
        for the currently authenticated user.
        """
        user = self.request.user
        return Recipe.objects.filter(created_by=user)

from django.shortcuts import render
from rest_framework import generics

from recipes.models import Recipe
from .serializers import RecipeSerializer

class RecipeListCreateAPIView(generics.ListCreateAPIView):
    queryset = Recipe.objects.all()
    serializer_class = RecipeSerializer

    def perform_create(self, serializer):
        serializer.save(created_by=self.request.user)

class MyRecipeListCreateAPIView(generics.ListCreateAPIView):
    # queryset = Recipe.objects.filter(created_by=request.user)
    serializer_class = RecipeSerializer

    def get_queryset(self):
        """
        This view should return a list of all the purchases
        for the currently authenticated user.
        """
        user = self.request.user
        return Recipe.objects.filter(created_by=user)
