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 Employee(models.Model): car_brand = models.CharField(max_length=20, help_text="Employee ID") model = models.CharField(max_length=100) price = models.IntegerField() release year = models.IntegerField()
class EmployeeAdmin(admin.ModelAdmin): list_display = ('car_brand','model','price','release year') admin.py from Django.contrib import admin from .models import Employee,EmployeeAdmin admin.site.register(Employee, EmployeeAdmin)
Thus the program for creating car inventory database database using ORM hass been executed successfully