Skip to content

Alfredsec/django-orm-app

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Django ORM Web Application

AIM

To develop a Django application to store and retrieve data from a database using Object Relational Mapping(ORM).

Entity Relationship Diagram

web ex02

DESIGN STEPS

STEP 1:

clone the repository from github.

STEP 2:

create an admin interface for django

STEP 3:

create an app and edit settings.py

STEP 4:

make migrations and migrate the changes.

STEP 5:

create admin user and write python code for admin and models.

STEP 6:

make all the migrations to 'myapp'.

STEP 7:

create an student database with 10 fields using runserver command.

PROGRAM

MODELS.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="reference number")
    name=models.CharField(max_length=100)
    age=models.IntegerField()
    email=models.EmailField()
    phoneno=models.IntegerField()

class StudentAdmin(admin.ModelAdmin):
    list_display=('referencenumber','name','age','email','phoneno')

ADMIN.PY

from django.contrib import admin
from .models import Student,StudentAdmin


# Register your models here.
admin.site.register(Student,StudentAdmin)

OUTPUT

SERVER OUTPUT

Screenshot 2023-05-27 163959

CLIENT OUTPUT

Screenshot 2023-05-27 042041

RESULT

The program for creating an student database using ORM is executed sucessfully.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%