add has_code_in_db

This commit is contained in:
2026-02-10 16:02:20 +03:30
parent e9117d881d
commit ec11352d69
5 changed files with 14 additions and 2 deletions

Binary file not shown.

View File

@@ -249,4 +249,15 @@ def apply_date_filter(queryset, date_filter):
)
return queryset.filter(**{f"{field}__gte": start})
return queryset
return queryset
@api_view(["GET"])
@permission_classes([AllowAny])
@csrf_exempt
def has_code_in_db(request):
code = request.GET['code']
if AllProductsTransport.objects.filter(Q(jihadi_origin=code)|Q(jihadi_destination=code)).exists():
return Response('ok',status=200)
return Response('not in db',status=404)

View File

@@ -4,7 +4,7 @@ from app import views as app_views
from app.excel_processing import transporting_detail_excel, total_killhouse_excel, hatching_excel, all_hatching_excel, \
all_send_different_bar_excel, transport_carcass_detail_excel, guilds_transport_carcass_detail_excel, \
all_products_transport_excel
from app.helper import get_bar_info, test_city, api_get_hatching_permit_code
from app.helper import get_bar_info, test_city, api_get_hatching_permit_code, has_code_in_db
from app.scripts import update_poultry_city_province
from app.views import get_transport_to_kill, add_kill_house, update_hatching, get_breeds, dashboard_total_kill_house, \
send_different_bar, send_different_bar_with_licence_number, all_province_detail_for_map, \
@@ -238,6 +238,7 @@ urlpatterns = [
path('get-all-products-transport-provinces-by-code/', get_all_products_transport_provinces_by_code),
path('all_products_transport_excel/', all_products_transport_excel),
path('get_ai_response/', get_ai_response),
path('has_code_in_db/', has_code_in_db),
]