To develop a Django application to store and retrieve data from a database using Object Relational Mapping(ORM).
Clone the repository from github
Create an admin page for Django.
create an app and edit settings.py
Makemigration and migrate the changes.
Create admin user and write python code for admin and models
Make all the migration to my app
Create a students database with 10 fields using runservercommand admin.py
from django.db import models
from django.contrib import admin
# Create your models here.
class Student(models.Model):
referencenumber=models.CharField(primary_key=True,max_length=20,help_text='Employee ID')
name=models.CharField(max_length=100)
age=models.IntegerField()
email=models.EmailField()
contact=models.IntegerField()
class StudentAdmin(admin.ModelAdmin):
list_display=('referencenumber','name','age','email','contact')
from django.contrib import admin
from .models import Student,StudentAdmin
admin.site.register(Student,StudentAdmin)
The program for creating a studentdatabase using ORM is executed successfully.