fix - some changes in pos randher/ web herd / web licestock/
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
from apps.core.mixins.soft_delete_mixin import SoftDeleteMixin
|
||||
from rest_framework import viewsets
|
||||
from apps.livestock import models as livestock_models
|
||||
from apps.tag.web.api.v1.api import TagViewSet
|
||||
from . import serializers as livestock_serializers
|
||||
from rest_framework.exceptions import APIException
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.response import Response
|
||||
from common.tools import CustomOperations
|
||||
from django.db import transaction
|
||||
from rest_framework import status
|
||||
from rest_framework import viewsets, filters
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.exceptions import APIException
|
||||
from rest_framework.response import Response
|
||||
|
||||
from apps.core.mixins.soft_delete_mixin import SoftDeleteMixin
|
||||
from apps.livestock import models as livestock_models
|
||||
from . import serializers as livestock_serializers
|
||||
|
||||
|
||||
def trash(queryset, pk):
|
||||
@@ -27,6 +26,16 @@ def delete(queryset, pk):
|
||||
class LiveStockViewSet(viewsets.ModelViewSet, SoftDeleteMixin): # noqa
|
||||
queryset = livestock_models.LiveStock.objects.all()
|
||||
serializer_class = livestock_serializers.LiveStockSerializer
|
||||
filter_backends = [filters.SearchFilter]
|
||||
search_fields = [
|
||||
"gender",
|
||||
"type__name",
|
||||
"use_type__name",
|
||||
"species__name",
|
||||
"herd__name",
|
||||
"herd__description",
|
||||
"herd__rancher__ranching_farm",
|
||||
]
|
||||
|
||||
@action(
|
||||
methods=['put'],
|
||||
|
||||
Reference in New Issue
Block a user