To develop a Django application to store and retrieve data from a database using Object Relational Mapping(ORM).
Start a project and create a superuser
Set a password and email
Make the neccessary changes in the models and admin.Then make migrations and run the server
models.py
from django.db import models
from django.contrib import admin
class employee (models.Model):
emp_id=models.CharField(primary_key=True,max_length=20,help_text="EMPLOYEE ID")
ename=models.CharField(max_length=100)
post=models.CharField(max_length=20)
salary=models.IntegerField()
email=models.EmailField()
class employeeAdmin(admin.ModelAdmin):
list_display=('emp_id','ename','post','email')
admin.py
from django.contrib import admin
from.models import employee,employeeAdmin
admin.site.register(employee,employeeAdmin)
Thus we developed a Django application to store and retrieve data from a database using Object Relational Mapping(ORM).