Software Solutions Company

Django CRUD Application

Oct. 17, 2022
Author: Asif


CRUD can be best explained as an approach to building a Django web application. In general CRUD means performing Create, Retrieve, Update and Delete operations on a table in a database. First follow the steps of installation from previous post Django Installation Steps

CRUD Application

Make sure file sequence first.

Make changing in setting.py for static and templates folders and also add app

 

 

 

STATIC_URL = '/static/'

STATICFILES_DIRS = [BASE_DIR / "static",]

STATIC_ROOT = "/static/"

 

After that make a file name file.txt in static folder and then access by url 127.0.0.1/static/file.txt

Make three html pages and add bootstrap folder in static

Base.html

 

Addandshow.html

This can be used for serial number 

 

{{ forloop.counter }} # starting index 1

{{ forloop.counter0 }} # starting index 0

 

 

For inline the buttons, we use:

class="d-inline"


 

updatestudent.html

 

Make models in models.py

 

 

Add in admin.py to register Model

These are must after creating model

python manage.py makemigrations

python manage.py migrate

python manage.py createsuperuser

And check the table in admin

 

Make form in forms.py

 

Urls.py


 

Add views.py

There is an option of clean data before enter in database

Important info

In forms add autocomplete="off". This is useful when after submisstion press back button. 

<form action="" method="POST" enctype="multipart/form-data" class="form-material form-horizontal" autocomplete="off">

Please share this page to friends.

Asif

Welcome to our Software Solutions Company, where we excel in transforming ideas into tangible realities. We have expertise in developing online management systems, website designing & development, software solutions, mobile app development, e-commerce solutions and graphic designing. We provide 24/7 services.

Popular Posts






Call To Action

Do you Need a website?

Order Now