diff --git a/competition/urls.py b/competition/urls.py index 6e316606..79032a54 100644 --- a/competition/urls.py +++ b/competition/urls.py @@ -18,6 +18,7 @@ router.register(r'grade', views.GradeViewSet) router.register(r'problem-administration', views.ProblemAdministrationViewSet) router.register(r'event-registration', views.EventRegistrationViewSet) +router.register(r'competition-type', views.CompetitionTypeViewSet) urlpatterns = [] diff --git a/competition/views.py b/competition/views.py index fd88360f..fa8324ea 100644 --- a/competition/views.py +++ b/competition/views.py @@ -17,14 +17,15 @@ from base.utils import mime_type from competition import utils -from competition.models import (Comment, Competition, Event, EventRegistration, - Grade, LateTag, Problem, Publication, - PublicationType, Semester, Series, Solution, - Vote) +from competition.models import (Comment, Competition, CompetitionType, Event, + EventRegistration, Grade, LateTag, Problem, + Publication, PublicationType, Semester, Series, + Solution, Vote) from competition.permissions import (CommentPermission, CompetitionRestrictedPermission, ProblemPermission) from competition.serializers import (CommentSerializer, CompetitionSerializer, + CompetitionTypeSerializer, EventRegistrationSerializer, EventSerializer, GradeSerializer, LateTagSerializer, ProblemSerializer, @@ -118,6 +119,13 @@ def slug(self, request: Request, slug: str = None) -> Response: ) +class CompetitionTypeViewSet(mixins.RetrieveModelMixin, + mixins.ListModelMixin, + viewsets.GenericViewSet): + queryset = CompetitionType.objects.all() + serializer_class = CompetitionTypeSerializer + + class CommentViewSet( mixins.RetrieveModelMixin, mixins.DestroyModelMixin,