From ec11352d69ec163f0fd4ff81a9c49411098b097c Mon Sep 17 00:00:00 2001 From: 7nimor <7nimor@gmail.com> Date: Tue, 10 Feb 2026 16:02:20 +0330 Subject: [PATCH] add has_code_in_db --- app/__pycache__/helper.cpython-39.pyc | Bin 7286 -> 7609 bytes app/__pycache__/models.cpython-39.pyc | Bin 21354 -> 21354 bytes app/__pycache__/urls.cpython-39.pyc | Bin 5716 -> 5768 bytes app/helper.py | 13 ++++++++++++- app/urls.py | 3 ++- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/__pycache__/helper.cpython-39.pyc b/app/__pycache__/helper.cpython-39.pyc index e96dcca0dd56a3d0ace8f232c88f78fe962bbafc..d2b7fed41196a25185bbe6d27c249de8bd4c9535 100644 GIT binary patch delta 366 zcmX|5K}y3=5dHJproY7mtO{DX=)zWl(xQk8?pn}|=)#q5LfQ%KkC4F6U#L`E#GP~@ z^#Cn;0ZBLBz%%p)UcjwRsyHz3J>D>H=Ih}7&~i<)$f%BLkFvb}WL4nxZ8L_tw}_=4 z#Nd^@b?m&aj#~Ga+ z0P-QsIWvS7o4`0XVQNnsn8h3#L&_$dNAaue!l}BUBpYU?FZ(V^CseX012Rg!+@Cw> zMOp@~mSHgC;nn8{EvN#)Z6OGCRR&e;$Y=W0&a2&YwlZ>!r8C33mXVH>mF9D`l}^%I zYWp8{NX@Li8#&z&Jx2x(cD~7r1Odwyc@-8wO-b9$b8*r2kJDb8n60>xD_= z;vc|2(U^Gi#MP63gBKq!rg{D*lkfX|=9f9m{2YBdmM+@u7KK(g{;s4&6y;ZYBUh3( zIl60SS7{7f`tm+i0R=iQ{Fi}zfM?Ui)wiO4Igy`G6*ShB{3K46r=SZ>4U>D*bnFoguC+ep10yqV^=+Gj#gt$qTz%9f>vJ4&} z-6Si}EyPQ*3SJ>Tk{tMi_|c@7*T63*K!?^LAS6h#0YM=ll1&H+36pF=SV#}aHuMPT zCE0;qA$=tJF7yfNC)$I4Ap<1)Fd!sCasUw_QIbQ53W<>%K}<-TY21!nI7!))_ zbQ^|*BuMT+LdY=5T^Rl+8YEGrujI6@)-}{1g(2<;hPi3%;f`W2cMLt;44SzO-4NFM zc$~s+?lksuXVA`_#R2XdMz~pwa_2Gj`Q8_W=LL-4%!@d9GcV!L&Af~WKD&Yr?kYOD zIUR?2Si>ZD9aG#59N}(an!ANw?lz8ccW{imiy7`7j&t|%7WV*M+(Vq;9-*(UJxt{9 z!||z-I{DrHUsGDk)cj~PsH(Bi=$Lc09FK~%!ub=xLg{e<&YIsl{+PY5od4_iaq2;}|>04A$e$*Fv zrD@62r~2q3gCSJ`1zJu5r$IBwv-2c$8a6LJ7cEu6rkY}oJOnL4A)*xs2?>*|LRd&Q$r^ME=^9lHblgsD9H{)g~Uj9Atq#iWDf>}#7XucE@Y7800xC5ND7bu*W<=7 zog}&gNpUDeau-rU(j@mF{ZAY)getuy_iJj+fetV*%pJyVZU%d}S?smXv@xrXw+Zax zPGUcI3U%%@Mz}eQa%V8coyCFohaVK4=P=%w=W(zxFJPiEFJh9lJ zG#ppX(%I3;Gr%kRQ`3#A+3%Wjmp_|tTw1|+X#aM9jGOJna(T3RR4J98Rx4h5%5>G` uyoArI6(8;PSI>*fY45q#lB2DXv%mQB`dd{|JZcBsLz@5ckN=gbUjGHaHwBUa 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), ]