To develop a Django application to store and retrieve data from a database using Object Relational Mapping(ORM).
Create a Django app Go to the app directory In models.py create two classes And save the models.py
Go to admins.py And put the two class in admins.py from the models.py And save the file
Start the Django server Then move to admin page
Write your own steps
from django.db import models
from django.contrib import admin
class Employee (models.Model):
unique_number=models.CharField(max_length=20,primary_key=True)
name=models.CharField(max_length=100)
age=models.IntegerField()
email=models.EmailField()
job=models.CharField(max_length=100)
class EmployeeAdmin(admin.ModelAdmin):
list_display=('unique_number','name','age','email','job')
from django.contrib import admin
from .models import Employee,EmployeeAdmin
admin.site.register(Employee,EmployeeAdmin)
The output for Django ORM is successful.