change dockeerfile
This commit is contained in:
@@ -23,7 +23,7 @@ from common.liara_tools import upload_to_liara
|
||||
from .serializers import (
|
||||
TagSerializer,
|
||||
TagAssignmentSerializer,
|
||||
AllocatedTagsSerializer, TagBatchSerializer, TagDistributionSerializer
|
||||
AllocatedTagsSerializer, TagBatchSerializer, TagDistributionSerializer, TagDistributionBatchSerializer
|
||||
)
|
||||
|
||||
|
||||
@@ -391,3 +391,50 @@ class TagDistributionViewSet(
|
||||
|
||||
serializer = self.serializer_class(distribution_data.get('tag_distributions'), many=True)
|
||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||
|
||||
@action(
|
||||
methods=['get'],
|
||||
detail=True,
|
||||
url_name='dist_by_batch',
|
||||
url_path='dist_by_batch',
|
||||
name='dist_by_batch'
|
||||
)
|
||||
def get_dist_by_batch(self, request, pk=None):
|
||||
"""
|
||||
get distributions by batch
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class TagDistributionBatchViewSet(
|
||||
BaseViewSet,
|
||||
SoftDeleteMixin,
|
||||
DynamicSearchMixin,
|
||||
viewsets.ModelViewSet,
|
||||
TagDistributionService
|
||||
):
|
||||
queryset = tag_models.TagDistributionBatch.objects.all()
|
||||
serializer_class = TagDistributionBatchSerializer
|
||||
filter_backends = [SearchFilter]
|
||||
search_filter = [
|
||||
'dist_batch_identity',
|
||||
'assigner_org__name',
|
||||
'assigned_org__name',
|
||||
'total_tag_count',
|
||||
'is_closed',
|
||||
]
|
||||
|
||||
def list(self, request, *args, **kwargs):
|
||||
"""
|
||||
list of tag distribution batches
|
||||
"""
|
||||
|
||||
queryset = self.get_queryset(visibility_by_org_scope=True).order_by('-create_date')
|
||||
|
||||
queryset = self.filter_query(self.filter_queryset(queryset))
|
||||
|
||||
page = self.paginate_queryset(queryset)
|
||||
if page is not None: # noqa
|
||||
serializer = self.get_serializer(page, many=True)
|
||||
return self.get_paginated_response(serializer.data)
|
||||
return Response(self.serializer_class(queryset).data)
|
||||
|
||||
@@ -178,3 +178,24 @@ class TagDistributionSerializer(serializers.ModelSerializer):
|
||||
}
|
||||
|
||||
return representation
|
||||
|
||||
|
||||
class TagDistributionBatchSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = tag_models.TagDistributionBatch
|
||||
fields = '__all__'
|
||||
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
|
||||
representation['assigner_org'] = {
|
||||
'id': instance.assigner_org.id,
|
||||
'name': instance.assigner_org.name,
|
||||
}
|
||||
|
||||
representation['assigned_org'] = {
|
||||
'id': instance.assigned_org.id,
|
||||
'name': instance.assigned_org.name
|
||||
}
|
||||
|
||||
return representation
|
||||
|
||||
@@ -4,7 +4,7 @@ from rest_framework.routers import DefaultRouter
|
||||
from .api import (
|
||||
TagViewSet,
|
||||
TagAssignmentViewSet,
|
||||
AllocatedTagsViewSet, TagBatchViewSet, TagDistributionViewSet
|
||||
AllocatedTagsViewSet, TagBatchViewSet, TagDistributionViewSet, TagDistributionBatchViewSet
|
||||
)
|
||||
|
||||
router = DefaultRouter()
|
||||
@@ -13,6 +13,7 @@ router.register(r'tag_assignment', TagAssignmentViewSet, basename='tag_assignmen
|
||||
router.register(r'allocated_tag', AllocatedTagsViewSet, basename='allocated_tag')
|
||||
router.register(r'tag_batch', TagBatchViewSet, basename='tag_batch')
|
||||
router.register(r'tag_distribution', TagDistributionViewSet, basename='tag_distribution')
|
||||
router.register(r'tag_distribution_batch', TagDistributionBatchViewSet, basename='tag_distribution_batch')
|
||||
|
||||
urlpatterns = [
|
||||
path('v1/', include(router.urls))
|
||||
|
||||
Reference in New Issue
Block a user