To develop a Django application to store and retrieve data from a database using Object Relational Mapping(ORM).
Create the folder'ex02' under directory 'unit2'
clone the github respository into the directory "ex02" using the command "git clone
Under the folder "django-orm-app" enter the directory titled "dataproject" and go to the "settings.py" under the file and "import in" line 34 set ALLOWED_HOST[*] and add myapp under the INSTALLED-APP
Now return to the parent folder "dataproject" and install the application myapp using the command "python3 manage.py startapp myapp"
Under the directory "myapp", open "models.py" and enter the code for the column headings
Under the directory "myapp", open "admin.py" and enter the code to set up the admin
Now return to the parent folder "dataproject", and into the prompt, enter the command "python3 manage.py make integrations"
Into the prompt, type the command "python3 manage.py migrate".
Now create a superuser by typing the command "python3 manage.py createsuperuser" into the prompt. Enter the username, leave the email address blank and enter the password to create to it
Into the prompt, type the command "python3 manage.py runserver 0:8000" to run the server at port number 8000
Now open the admin login page and enter the username and password to login.
Under the "MYAPP" section, click on "Add" next to the "Students" to create a record. Create 10 records in the same way.
Once the records are made, take a screenshot and save it.
Upload Write your own steps
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="reference number")
name=models.CharField(max_length=100)
age=models.IntegerField()
email=models.EmailField()
phonenumber=models.IntegerField()
class StudentAdmin(admin.ModelAdmin):
list_display=('referencenumber','name','age','email','phonenumber')from django.contrib import admin
from .models import Student,StudentAdmin
# Register your models here.
admin.site.register(Student,StudentAdmin)The program was executed successfully


