diff --git a/app/__pycache__/helper.cpython-39.pyc b/app/__pycache__/helper.cpython-39.pyc index e96dcca..d2b7fed 100644 Binary files a/app/__pycache__/helper.cpython-39.pyc and b/app/__pycache__/helper.cpython-39.pyc differ diff --git a/app/__pycache__/models.cpython-39.pyc b/app/__pycache__/models.cpython-39.pyc index 66c6394..971506d 100644 Binary files a/app/__pycache__/models.cpython-39.pyc and b/app/__pycache__/models.cpython-39.pyc differ diff --git a/app/__pycache__/urls.cpython-39.pyc b/app/__pycache__/urls.cpython-39.pyc index 888c2f4..29c8983 100644 Binary files a/app/__pycache__/urls.cpython-39.pyc and b/app/__pycache__/urls.cpython-39.pyc differ diff --git a/app/helper.py b/app/helper.py index e694311..c127e13 100644 --- a/app/helper.py +++ b/app/helper.py @@ -249,4 +249,15 @@ def apply_date_filter(queryset, date_filter): ) return queryset.filter(**{f"{field}__gte": start}) - return queryset \ No newline at end of file + 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) \ No newline at end of file diff --git a/app/urls.py b/app/urls.py index d41facc..0a79901 100644 --- a/app/urls.py +++ b/app/urls.py @@ -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), ]