diff --git a/competition/serializers.py b/competition/serializers.py index 9f37b0bc..66da30ee 100644 --- a/competition/serializers.py +++ b/competition/serializers.py @@ -27,6 +27,13 @@ def get_is_registered(self, obj): return None +@ts_interface(context='competition') +class PublicationTypeSerializer(serializers.ModelSerializer): + class Meta: + model = models.PublicationType + fields = '__all__' + + @ts_interface(context='competition') class PublicationSerializer(serializers.ModelSerializer): class Meta: diff --git a/competition/urls.py b/competition/urls.py index 79032a54..6e5a8c02 100644 --- a/competition/urls.py +++ b/competition/urls.py @@ -19,6 +19,7 @@ router.register(r'problem-administration', views.ProblemAdministrationViewSet) router.register(r'event-registration', views.EventRegistrationViewSet) router.register(r'competition-type', views.CompetitionTypeViewSet) +router.register(r'publication-type', views.PublicationTypeViewSet) urlpatterns = [] diff --git a/competition/views.py b/competition/views.py index fa8324ea..548b6a3c 100644 --- a/competition/views.py +++ b/competition/views.py @@ -30,7 +30,9 @@ EventSerializer, GradeSerializer, LateTagSerializer, ProblemSerializer, ProblemWithSolutionsSerializer, - PublicationSerializer, SemesterSerializer, + PublicationSerializer, + PublicationTypeSerializer, + SemesterSerializer, SemesterWithProblemsSerializer, SeriesWithProblemsSerializer, SolutionSerializer) @@ -119,9 +121,7 @@ def slug(self, request: Request, slug: str = None) -> Response: ) -class CompetitionTypeViewSet(mixins.RetrieveModelMixin, - mixins.ListModelMixin, - viewsets.GenericViewSet): +class CompetitionTypeViewSet(viewsets.ReadOnlyModelViewSet): queryset = CompetitionType.objects.all() serializer_class = CompetitionTypeSerializer @@ -817,6 +817,11 @@ class EventRegistrationViewSet(viewsets.ModelViewSet): permission_classes = (CompetitionRestrictedPermission,) +class PublicationTypeViewSet(viewsets.ReadOnlyModelViewSet): + queryset = PublicationType.objects.all() + serializer_class = PublicationTypeSerializer + + class PublicationViewSet(viewsets.ModelViewSet): """Publikácie(výsledky, brožúrky, časopisy, ...)""" queryset = Publication.objects.all()