first commit

This commit is contained in:
2026-01-18 11:29:19 +03:30
commit b42c80cf1c
354 changed files with 14705 additions and 0 deletions

24
app/scripts.py Normal file
View File

@@ -0,0 +1,24 @@
from rest_framework import status
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from app.models import PoultryHatching, Poultry
from django.db import transaction
from django.views.decorators.csrf import csrf_exempt
from rest_framework.decorators import api_view, permission_classes
@api_view(['POST'])
@permission_classes([AllowAny])
@csrf_exempt
def update_poultry_city_province(request):
hatchings = PoultryHatching.objects.select_related('poultry').only('poultry', 'LocationNameCity',
'LocationNameProvince').filter(
poultry__isnull=False).order_by('id')
for hatching in hatchings:
hatching.poultry.LocationNameProvince = hatching.LocationNameProvince
hatching.poultry.LocationNameCity = hatching.LocationNameCity
hatching.poultry.save()
print(hatching.id)
return Response({'message': 'done'}, status=status.HTTP_200_OK)
# return Response({'message': len(hatchings)}, status=status.HTTP_200_OK)