Skip to content
Snippets Groups Projects
Verified Commit b721d3c4 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

feat: rename HostViewset -> ProfileViewset

parent 72ac2272
No related branches found
No related tags found
No related merge requests found
......@@ -48,13 +48,13 @@ from program import filters
from program.models import (
Category,
FundingCategory,
Host,
Image,
Language,
License,
LinkType,
MusicFocus,
Note,
Profile,
RadioSettings,
RRule,
Schedule,
......@@ -68,7 +68,6 @@ from program.serializers import (
CategorySerializer,
ErrorSerializer,
FundingCategorySerializer,
HostSerializer,
ImageRenderSerializer,
ImageSerializer,
LanguageSerializer,
......@@ -77,6 +76,7 @@ from program.serializers import (
MusicFocusSerializer,
NoteSerializer,
PlayoutEntrySerializer,
ProfileSerializer,
ProgramEntrySerializer,
RadioSettingsSerializer,
RRuleSerializer,
......@@ -891,22 +891,22 @@ class APILanguageViewSet(ActiveFilterMixin, viewsets.ModelViewSet):
@extend_schema_view(
create=extend_schema(summary="Create a new host."),
retrieve=extend_schema(summary="Retrieve a single host."),
update=extend_schema(summary="Update an existing host."),
partial_update=extend_schema(summary="Partially update an existing host."),
destroy=extend_schema(summary="Delete an existing host."),
list=extend_schema(summary="List all hosts."),
create=extend_schema(summary="Create a new profile."),
retrieve=extend_schema(summary="Retrieve a single profile."),
update=extend_schema(summary="Update an existing profile."),
partial_update=extend_schema(summary="Partially update an existing profile."),
destroy=extend_schema(summary="Delete an existing profile."),
list=extend_schema(summary="List all profiles."),
)
class APIHostViewSet(ActiveFilterMixin, viewsets.ModelViewSet):
queryset = Host.objects.all().order_by("-is_active", "name")
serializer_class = HostSerializer
class APIProfileViewSet(ActiveFilterMixin, viewsets.ModelViewSet):
queryset = Profile.objects.all().order_by("-is_active", "name")
serializer_class = ProfileSerializer
pagination_class = LimitOffsetPagination
filter_backends = [drf_filters.SearchFilter]
search_fields = ["name", "email"]
def create(self, request, *args, **kwargs):
serializer = HostSerializer(
serializer = ProfileSerializer(
# FIXME: the method get_serializer_context should be used but it does seem to get lost
context={"request": request}, # the serializer needs the request in the context
data=request.data,
......@@ -917,13 +917,13 @@ class APIHostViewSet(ActiveFilterMixin, viewsets.ModelViewSet):
def update(self, request, *args, **kwargs):
partial = kwargs.get("partial", False)
host = self.get_object()
profile = self.get_object()
serializer = HostSerializer(
serializer = ProfileSerializer(
# FIXME: the method get_serializer_context should be used but it does seem to get lost
context={"request": request}, # the serializer needs the request in the context
data=request.data,
instance=host,
instance=profile,
partial=partial,
)
......@@ -983,8 +983,8 @@ class APILicenseViewSet(viewsets.ModelViewSet):
"id": 1,
"cba": {"domains": ["cba.media"]},
"imageRequirements": {
"host.image": {"frame": {"aspectRatio": [1, 1], "shape": "round"}},
"note.image": {"frame": {"aspectRatio": [16, 9], "shape": "round"}},
"profile.image": {"frame": {"aspectRatio": [1, 1], "shape": "round"}},
"show.image": {"frame": {"aspectRatio": [16, 9], "shape": "round"}},
"show.logo": {"frame": {"aspectRatio": [1, 1], "shape": "round"}},
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment