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.db import models
from django.contrib import admin
class car(models.Model):
mod_num=models.IntegerField(primary_key=True)
car_name=models.CharField(max_length=20)
car_color=models.CharField(max_length=20)
car_num=models.IntegerField()
price=models.IntegerField()
class carAdmin(admin.ModelAdmin):
list_display=["mod_num","car_name","car_color","car_num","price"]
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