34 lines
824 B
Python
34 lines
824 B
Python
from django.shortcuts import render
|
|
from rest_framework import pagination, status, viewsets
|
|
from rest_framework.response import Response
|
|
|
|
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
|