To develop a Django application to store and retrieve data from a Car Inventory Database using Object Relational Mapping(ORM).
Clone the problem from GitHub
Create a new app in Django project
Enter the code for admin.py and models.py
Execute Django admin and create details for 5 Car
models.py
from django.db import models # type: ignore
from django.contrib import admin # type: ignore
class Car(models.Model):
car_brand = models.CharField()
car_model = models.CharField()
car_manufacturedate = models.DateField()
car_colour = models.CharField()
car_fc = models.DateField()
car_fueltype = models.CharField()
class CarAdmin(admin.ModelAdmin):
list_display = ('car_brand', 'car_model', 'car_manufacturedate', 'car_colour', 'car_fc', 'car_fueltype')
admin.py
from django.contrib import admin
from.models import Car,CarAdmin
admin.site.register(Car,CarAdmin)
Thus the program for creating car inventory database database using ORM hass been executed successfully
