added wherehouse json

This commit is contained in:
behruz-dev
2025-10-24 16:24:11 +05:00
parent 4cda8468fc
commit 0c460b507e
4 changed files with 7510 additions and 7058 deletions

View File

@@ -0,0 +1,22 @@
import json
from django.core.management import BaseCommand
from core.apps.wherehouse.models import WhereHouse
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('file_path', type=str, help='Path to JSON file')
def handle(self, *args, **options):
file_path = options['file_path']
with open(file_path, 'r') as f:
data = json.load(f)
for item in data['data']['warehouses']:
WhereHouse.objects.get_or_create(
name=item['name']
)
self.stdout.write("Warehouses added")