first commit
This commit is contained in:
18
utils/views.py
Normal file
18
utils/views.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from django.shortcuts import render
|
||||
from rest_framework.generics import ListCreateAPIView
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
|
||||
from utils.models import JsonToType
|
||||
from utils.serializers import JsonToTypeSerializer
|
||||
|
||||
|
||||
# Create your views here.
|
||||
class JsonToTypeListCreate(ListCreateAPIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
serializer_class = JsonToTypeSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
return JsonToType.objects.filter(user=self.request.user, is_active=True).order_by('-updated_at')
|
||||
|
||||
def perform_create(self, serializer):
|
||||
serializer.save(user=self.request.user)
|
||||
Reference in New Issue
Block a user