geriou-bir/grids/views.py

34 lines
824 B
Python
Raw Normal View History

2023-09-10 15:32:07 +00:00
from django.shortcuts import render
2023-09-12 15:07:47 +00:00
from rest_framework import pagination, status, viewsets
from rest_framework.response import Response
2023-09-10 15:32:07 +00:00
2023-09-12 15:07:47 +00:00
from .models import Word, Grid, Placement, Level
from .serializers import (
WordSerializer,
GridSerializer,
PlacementSerializer,
LevelSerializer,
)
class LevelViewSet(viewsets.ModelViewSet):
queryset = Level.objects.all()
serializer_class = LevelSerializer
ordering_fields = ["level_number"]
class WordViewSet(viewsets.ModelViewSet):
queryset = Word.objects.all()
serializer_class = WordSerializer
class GridViewSet(viewsets.ModelViewSet):
queryset = Grid.objects.all()
serializer_class = GridSerializer
class PlacementViewSet(viewsets.ModelViewSet):
queryset = Placement.objects.all()
serializer_class = PlacementSerializer