From 835a484202426b27f6673a4b2b17d4e6770ec248 Mon Sep 17 00:00:00 2001 From: olawale afuye Date: Sat, 21 Jan 2023 21:16:20 +0100 Subject: [PATCH] created groups --- siteinfo/views.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 siteinfo/views.py diff --git a/siteinfo/views.py b/siteinfo/views.py new file mode 100644 index 0000000..32d00e1 --- /dev/null +++ b/siteinfo/views.py @@ -0,0 +1,30 @@ +from .models import Post, Comment +from .serializers import PostSerializer, CommentSerializer +from rest_framework import generics +# from django.db.models import Count + + +class PostCreateAPIView(generics.CreateAPIView): + queryset = Post.objects.all() + serializer_class = PostSerializer + + +class PostListAPIView(generics.ListAPIView): + queryset = Post.objects.all() + serializer_class = PostSerializer + + +class PostRetrieveAPIView(generics.RetrieveAPIView): + + queryset = Post.objects.all() + serializer_class = PostSerializer + + +class PostUpdateAPIView(generics.UpdateAPIView): + queryset = Post.objects.all() + serializer_class = PostSerializer + + +class PostDestroyAPIView(generics.DestroyAPIView): + queryset = Post.objects.all() + serializer_class = PostSerializer