add has_code_in_db
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -250,3 +250,14 @@ def apply_date_filter(queryset, date_filter):
|
|||||||
return queryset.filter(**{f"{field}__gte": start})
|
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)
|
||||||
@@ -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, \
|
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_send_different_bar_excel, transport_carcass_detail_excel, guilds_transport_carcass_detail_excel, \
|
||||||
all_products_transport_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.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, \
|
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, \
|
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('get-all-products-transport-provinces-by-code/', get_all_products_transport_provinces_by_code),
|
||||||
path('all_products_transport_excel/', all_products_transport_excel),
|
path('all_products_transport_excel/', all_products_transport_excel),
|
||||||
path('get_ai_response/', get_ai_response),
|
path('get_ai_response/', get_ai_response),
|
||||||
|
path('has_code_in_db/', has_code_in_db),
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user