diff --git a/app/__pycache__/helper.cpython-39.pyc b/app/__pycache__/helper.cpython-39.pyc index b7cc30a..43376aa 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 0a3f598..b18875b 100644 Binary files a/app/__pycache__/models.cpython-39.pyc and b/app/__pycache__/models.cpython-39.pyc differ diff --git a/app/__pycache__/serializers.cpython-39.pyc b/app/__pycache__/serializers.cpython-39.pyc index 6877fe9..98ff34d 100644 Binary files a/app/__pycache__/serializers.cpython-39.pyc and b/app/__pycache__/serializers.cpython-39.pyc differ diff --git a/app/__pycache__/urls.cpython-39.pyc b/app/__pycache__/urls.cpython-39.pyc index 8daa7bd..888c2f4 100644 Binary files a/app/__pycache__/urls.cpython-39.pyc and b/app/__pycache__/urls.cpython-39.pyc differ diff --git a/app/__pycache__/views.cpython-39.pyc b/app/__pycache__/views.cpython-39.pyc index 5ea4d88..482277c 100644 Binary files a/app/__pycache__/views.cpython-39.pyc and b/app/__pycache__/views.cpython-39.pyc differ diff --git a/app/migrations/0047_hatching_loadingsum.py b/app/migrations/0047_hatching_loadingsum.py new file mode 100644 index 0000000..b41f276 --- /dev/null +++ b/app/migrations/0047_hatching_loadingsum.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.19 on 2026-02-07 09:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0046_rasadyarappinfo'), + ] + + operations = [ + migrations.AddField( + model_name='hatching', + name='loadingSum', + field=models.IntegerField(default=0), + ), + ] diff --git a/app/migrations/__pycache__/0047_hatching_loadingsum.cpython-39.pyc b/app/migrations/__pycache__/0047_hatching_loadingsum.cpython-39.pyc new file mode 100644 index 0000000..1d05628 Binary files /dev/null and b/app/migrations/__pycache__/0047_hatching_loadingsum.cpython-39.pyc differ diff --git a/app/models.py b/app/models.py index acec0bd..e5d1c7b 100644 --- a/app/models.py +++ b/app/models.py @@ -229,6 +229,7 @@ class Hatching(BaseModel): LeftOver = models.IntegerField(null=True) samasat_discharge_percentage = models.IntegerField(default=0) GoodSum = models.IntegerField(default=0) + loadingSum = models.IntegerField(default=0) def save(self, *args, **kwargs): if hasattr(self, 'PedigreeName') and self.PedigreeName in correction_dict: diff --git a/app/views.py b/app/views.py index a771aab..575aa80 100644 --- a/app/views.py +++ b/app/views.py @@ -858,11 +858,14 @@ class HatchingsViewSet(viewsets.ModelViewSet): poultry = Poultry.objects.filter(SystemCode=system_code).first() bars = request.data.get('Transports', []) + good_sums = request.data.get('GoodSum', []) if 'Transports' in request.data: request.data.pop('Transports') evacuation_details = request.data.get('EvacuationDetail', []) if 'EvacuationDetail' in request.data: request.data.pop('EvacuationDetail') + if 'GoodSum' in request.data: + request.data.pop('GoodSum') hatching = Hatching.objects.filter(RequestCode=request.data['RequestCode']).first() print({'1': request.data['ProvinceName']}) @@ -871,6 +874,8 @@ class HatchingsViewSet(viewsets.ModelViewSet): setattr(hatching, key, value) if hatching.poultry is None: hatching.poultry=poultry + hatching.GoodSum = good_sums['goodSum'] + hatching.loadingSum = good_sums['loadingSum'] hatching.save() else: @@ -880,6 +885,8 @@ class HatchingsViewSet(viewsets.ModelViewSet): request.data['Period'] = period hatching = Hatching.objects.create(**request.data) hatching.ArchiveDate = hatching.Date + datetime.timedelta(days=76) + hatching.GoodSum = good_sums['goodSum'] + hatching.loadingSum = good_sums['loadingSum'] if poultry: hatching.poultry = poultry diff --git a/fix_sequence.py b/fix_sequence.py new file mode 100644 index 0000000..81f9740 --- /dev/null +++ b/fix_sequence.py @@ -0,0 +1,17 @@ +import os +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'RSI.settings') + +import django +django.setup() + +from django.db import connection + +cursor = connection.cursor() +cursor.execute("SELECT setval('django_content_type_id_seq', (SELECT MAX(id) FROM django_content_type));") +print('Content type sequence reset to:', cursor.fetchone()[0]) + +cursor.execute("SELECT setval('auth_permission_id_seq', (SELECT MAX(id) FROM auth_permission));") +print('Auth permission sequence reset to:', cursor.fetchone()[0]) + +print('Done!') +