To develop a Django application to store and retrieve data from a Book 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
admin.py
from django.contrib import admin from .models import football_players,football_playersAdmin admin.site.register(football_players,football_playersAdmin)
models.py
from django.db import models from django.contrib import admin class football_players(models.Model): first_name=models.CharField(max_length=30) last_name=models.CharField(max_length=30) dob=models.DateField() age=models.IntegerField() matches_played=models.IntegerField() total_goals=models.IntegerField() email=models.EmailField()
class football_playersAdmin(admin.ModelAdmin): list_display=('first_name','last_name','dob','age','matches_played','total_goals','email')
Thus the program for creating a database using ORM hass been executed successfully