Skip to content

Commit

Permalink
Merge 5c3b2f7 into d4ac26a
Browse files Browse the repository at this point in the history
  • Loading branch information
simozhan committed Aug 26, 2015
2 parents d4ac26a + 5c3b2f7 commit 13ed331
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pdc/apps/repository/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,24 @@ class RepoFamilySerializer(StrictSerializerMixin, serializers.ModelSerializer):
class Meta:
model = models.RepoFamily
fields = ("name", "description")


class ContentCategorySerializer(StrictSerializerMixin, serializers.ModelSerializer):

class Meta:
model = models.ContentCategory
fields = ('name', 'description',)


class ContentFormatSerializer(StrictSerializerMixin, serializers.ModelSerializer):

class Meta:
model = models.ContentFormat
fields = ('name', 'description',)


class ServiceSerializer(StrictSerializerMixin, serializers.ModelSerializer):

class Meta:
model = models.Service
fields = ('name', 'description',)
72 changes: 72 additions & 0 deletions pdc/apps/repository/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def create(self, *args, **kwargs):
%(WRITABLE_SERIALIZER)s
*content_category*: $LINK:contentdeliverycontentcategory-list$
*content_format*: $LINK:contentdeliverycontentformat-list$
*repo_family*: $LINK:contentdeliveryrepofamily-list$
There are additional validations for the content delivery repository name for specific
Expand All @@ -62,6 +66,8 @@ def create(self, *args, **kwargs):
aus | .aus or .ll
els | els
*service*: $LINK:contentdeliveryservice-list$
__Response__: Same as input data.
"""
return super(RepoViewSet, self).create(*args, **kwargs)
Expand Down Expand Up @@ -283,3 +289,69 @@ def list(self, request, *args, **kwargs):
}
"""
return super(RepoFamilyViewSet, self).list(request, *args, **kwargs)


class ContentCategoryViewSet(StrictQueryParamMixin,
mixins.ListModelMixin,
viewsets.GenericViewSet):
"""
API endpoint that allows content_category to be viewed.
"""
serializer_class = serializers.ContentCategorySerializer
queryset = models.ContentCategory.objects.all()

def list(self, request, *args, **kwargs):
"""
__Method__: GET
__URL__: $LINK:contentdeliverycontentcategory-list$
__Response__:
%(SERIALIZER)s
"""
return super(ContentCategoryViewSet, self).list(request, *args, **kwargs)


class ContentFormatViewSet(StrictQueryParamMixin,
mixins.ListModelMixin,
viewsets.GenericViewSet):
"""
API endpoint that allows content_format to be viewed.
"""
serializer_class = serializers.ContentFormatSerializer
queryset = models.ContentFormat.objects.all()

def list(self, request, *args, **kwargs):
"""
__Method__: GET
__URL__: $LINK:contentdeliverycontentformat-list$
__Response__:
%(SERIALIZER)s
"""
return super(ContentFormatViewSet, self).list(request, *args, **kwargs)


class ServiceViewSet(StrictQueryParamMixin,
mixins.ListModelMixin,
viewsets.GenericViewSet):
"""
API endpoint that allows service to be viewed.
"""
serializer_class = serializers.ServiceSerializer
queryset = models.Service.objects.all()

def list(self, request, *args, **kwargs):
"""
__Method__: GET
__URL__: $LINK:contentdeliveryservice-list$
__Response__:
%(SERIALIZER)s
"""
return super(ServiceViewSet, self).list(request, *args, **kwargs)
6 changes: 6 additions & 0 deletions pdc/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,9 @@
base_name='findcomposewitholderpackage')
router.register(r'release-variants',
release_views.ReleaseVariantViewSet)
router.register(r'content-delivery-content-category', repo_views.ContentCategoryViewSet,
base_name='contentdeliverycontentcategory')
router.register(r'content-delivery-content-format', repo_views.ContentFormatViewSet,
base_name='contentdeliverycontentformat')
router.register(r'content-delivery-service', repo_views.ServiceViewSet,
base_name='contentdeliveryservice')

0 comments on commit 13ed331

Please sign in to comment.