fix - uncomment rancher duplicate eception in pos
This commit is contained in:
@@ -7,6 +7,7 @@ from rest_framework.permissions import AllowAny
|
||||
from rest_framework.response import Response
|
||||
|
||||
from apps.core.mixins.search_mixin import DynamicSearchMixin
|
||||
from apps.herd.exception import DuplicateRancherException
|
||||
from apps.herd.models import Herd, Rancher
|
||||
from apps.herd.pos.api.v1.serializers import HerdSerializer, RancherSerializer
|
||||
from apps.livestock.web.api.v1.serializers import LiveStockSerializer
|
||||
@@ -140,8 +141,8 @@ class RancherViewSet(viewsets.ModelViewSet, DynamicSearchMixin):
|
||||
|
||||
rancher = self.queryset.filter(national_code=request.data['national_code'])
|
||||
|
||||
# if len(rancher) > 1:
|
||||
# raise DuplicateRancherException()
|
||||
if len(rancher) > 1:
|
||||
raise DuplicateRancherException()
|
||||
|
||||
if rancher.exists():
|
||||
serializer = self.serializer_class(rancher.first())
|
||||
|
||||
Reference in New Issue
Block a user