Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 2 #3

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Ex02 Django ORM Web Application
## Date:
## Date:16/3/2024

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

## Entity Relationship Diagram
![WhatsApp Image 2024-03-22 at 10 30 42_652cbb3c](https://github.com/veslin23000303/ORM/assets/151148539/056cbcad-d143-4e5e-be98-d82826a913d3)


Include your ER diagram here

## DESIGN STEPS

Expand All @@ -23,13 +24,32 @@ Enter the code for admin.py and models.py
Execute Django admin and create details for 10 books

## PROGRAM

Include your code here
```
models.py
from django.db import models
from django.contrib import admin

# Create your models here.
class Book(models.Model):
book_id = models.IntegerField(primary_key=True)
book_name = models.CharField(max_length=100)
Author= models.CharField(max_length=50)
Date= models.DateField()
price = models.IntegerField()

class Display_book(admin.ModelAdmin):
list_display = ('book_id','book_name','Author','Date','price')

admin.py
from django.contrib import admin
from .models import Book,Display_book
# Register your models here.

admin.site.register (Book, Display_book)
```

## OUTPUT

Include the screenshot of your admin page.

![Screenshot 2024-03-16 214443](https://github.com/Veslinanish/ORM/assets/163664011/43fc8a0e-3603-4a68-9353-06d420b62250)

## RESULT
Thus the program for creating a database using ORM hass been executed successfully
Binary file added Screenshot 2024-03-16 214443.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.