To develop a Django application to store and retrieve data from a database using Object Relational Mapping(ORM).
STEP 3: Under the folder "django-orm-app", enter the directory titled "dataproject" and enter the folder "dataproject" and go to the file "settings.py". Under the file, type "import os" in line 14, set ALLOWED_HOSTS=['*'] and add 'myapp' under the list INSTALLED_APPS.
STEP 4: Return to the parent folder "dataproject" and install the application myapp using the command "python3 manage.py startapp myapp"
STEP 7: Return to the parent folder "dataproject", and into the prompt, enter the command "python3 manage.py makemigrations"
STEP 9: 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 twice to create it.
STEP 10: Into the prompt, type the command "python3 manage.py runserver 0:8000" to run the server at port number 8000
STEP 12: Under the "MYAPP" section, click on "Add" next to "Students" to create a record. Create 10 records in the same way.
STEP 14: Upload the screenshot into the "dataproject" directory by right-clicking on it and selecting "Upload Files"
STEP 15: Once exited from the server, type the codes necessary for pushing the files into the GitHub repository.
from django.contrib import admin
from .models import Student,StudentAdmin
# Register your models here.
admin.site.register(Student,StudentAdmin)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')This program is executed successfully.


