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 10 books
models.py
from django.contrib import admin
class cars(models.Model):
car_id=models.IntegerField(primary_key=True)
car_model=models.CharField(max_length=20)
email=models.EmailField()
dop=models.DateField()
car_type=models.CharField(max_length=10)
class carsAdmin(admin.ModelAdmin):
list_display=["car_id",'car_model','email','dop','car_type']
admin.py
from django.contrib import admin
from .models import cars,carsAdmin
admin.site.register(cars,carsAdmin)
Thus the program for creating car inventory database database using ORM hass been executed successfully
.png)