57 lines
2.1 KiB
Python
57 lines
2.1 KiB
Python
from django.core.management.base import BaseCommand
|
|
|
|
from inventory.services import get_model, get_make, decodevin
|
|
|
|
|
|
class Command(BaseCommand):
|
|
help = "Seed the Customer model with 20 records"
|
|
|
|
def handle(self, *args, **kwargs):
|
|
# vin,description = self.generate_vin()
|
|
result = decodevin("1HGCM82633A123456")
|
|
self.stdout.write(
|
|
self.style.SUCCESS(
|
|
"####################################################################################################"
|
|
)
|
|
)
|
|
self.stdout.write(
|
|
self.style.SUCCESS(
|
|
"####################################################################################################"
|
|
)
|
|
)
|
|
# self.stdout.write(self.style.SUCCESS(f'Generated VIN: {vin}'))
|
|
# self.stdout.write(self.style.SUCCESS(f'Description: {description}'))
|
|
self.stdout.write(
|
|
self.style.SUCCESS(
|
|
"####################################################################################################"
|
|
)
|
|
)
|
|
self.stdout.write(
|
|
self.style.SUCCESS(
|
|
"####################################################################################################"
|
|
)
|
|
)
|
|
self.stdout.write(self.style.SUCCESS(f"Decoded VIN: {result}"))
|
|
make, model, year_model = result.values()
|
|
self.stdout.write(
|
|
self.style.SUCCESS(
|
|
f'VIN:"1HGCM82633A123456" - Make {make} - Model {model} - Model Year {year_model}'
|
|
)
|
|
)
|
|
make = get_make(make)
|
|
model = get_model(model, make)
|
|
|
|
self.stdout.write(
|
|
self.style.SUCCESS(f"Make: {make} - Model: {model} - Year: {year_model}")
|
|
)
|
|
self.stdout.write(
|
|
self.style.SUCCESS(
|
|
"####################################################################################################"
|
|
)
|
|
)
|
|
self.stdout.write(
|
|
self.style.SUCCESS(
|
|
"####################################################################################################"
|
|
)
|
|
)
|