

{"id":69227,"date":"2019-09-07T17:26:47","date_gmt":"2019-09-07T11:56:47","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=69227"},"modified":"2021-06-21T12:19:20","modified_gmt":"2021-06-21T06:49:20","slug":"django-crud-example","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/django-crud-example\/","title":{"rendered":"Django CRUD Tutorial &#8211; Operations and Application Development"},"content":{"rendered":"<p><strong>Django CRUD tutorial &#8211;<\/strong> Django is an amazing framework.\u00a0Now, it\u2019s time to make a web application using newly gained skills. We will discuss some important concepts required while making an application.<\/p>\n<p>In this tutorial, we are developing a library application. You can have a glimpse of the application here.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Library-App-Preview.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69233\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Library-App-Preview.png\" alt=\"Library App Preview - Django CRUD\" width=\"1920\" height=\"943\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Library-App-Preview.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Library-App-Preview-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Library-App-Preview-300x147.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Library-App-Preview-768x377.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Library-App-Preview-1024x503.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Library-App-Preview-520x255.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><span style=\"color: #ff6600;\"><em><strong>&#8220;You might not think that programmers are artists, but programming is an extremely creative profession. It&#8217;s logic-based creativity.&#8221;<\/strong><\/em><\/span><\/p>\n<p style=\"text-align: right;\"><strong>&#8211; John Romero<\/strong><\/p>\n<h3>What is CRUD?<\/h3>\n<p><em>CRUD stands for Create, Read, Update &amp; Delete.<\/em> These are the four basic operations which are executed on Database Models. We are developing a web app which is capable of performing these operations.<\/p>\n<p>Since we are developing a library app, let\u2019s take an example of the same. In a library, books are objects. The books have attributes like name, author, etc. We need an application which can perform CRUD operations on book object. The CRUD operations are defined as follows:<\/p>\n<p><strong>1. Read Operation<\/strong><\/p>\n<p>The ability of the application to read data from the database.<\/p>\n<p><strong>2. Create Operation<\/strong><\/p>\n<p>The ability of the application to store data in the database.<\/p>\n<p><strong>3. Update Operation<\/strong><\/p>\n<p>The ability of the application to edit the stored value in the database.<\/p>\n<p><strong>4. Delete Operation<\/strong><\/p>\n<p>The ability of the application to delete the value in the database.<\/p>\n<p>We are going to develop the operations in the same order.<\/p>\n<p>Majority of applications on the internet are CRUD applications. <strong>For example &#8211;<\/strong> Facebook uses CRUD operations to save your data on their database. You can change your profile picture that means perform the update operation. Of course, you can see the data in-app or browser which is read operation.<\/p>\n<p>Also, you can delete your Facebook account which is delete operation. Summarising it, almost all the applications you use are CRUD applications.<\/p>\n<p>For developers, making a CRUD application is one of the very first steps. If you can make a CRUD app from technology then you can start deploying projects.<\/p>\n<h3>Django CRUD Tutorial<\/h3>\n<p>Let&#8217;s explore the steps to design a CRUD application in Django framework:<\/p>\n<h4>1. Making a Library CRUD Application<\/h4>\n<p>Our first steps would be to make a new project in Django and a new virtual environment. To make a virtual environment, enter:<\/p>\n<p style=\"text-align: center;\"><em><strong>virtualenv library<\/strong><\/em><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/virtualenv-library.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69234\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/virtualenv-library.png\" alt=\"virtualenv library - Django CRUD\" width=\"674\" height=\"85\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/virtualenv-library.png 674w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/virtualenv-library-150x19.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/virtualenv-library-300x38.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/virtualenv-library-520x66.png 520w\" sizes=\"auto, (max-width: 674px) 100vw, 674px\" \/><\/a><\/p>\n<p>Now, install the necessary software in this environment. Once, the environment is set up, activate the same. After activating the environment, install django on it.<\/p>\n<p style=\"text-align: center;\"><em><strong>pip install django==2.1.7<\/strong><\/em><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-django.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69235\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-django.png\" alt=\"pip install django - Django CRUD\" width=\"1604\" height=\"186\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-django.png 1604w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-django-150x17.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-django-300x35.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-django-768x89.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-django-1024x119.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-django-520x60.png 520w\" sizes=\"auto, (max-width: 1604px) 100vw, 1604px\" \/><\/a><\/p>\n<p>After the installation is complete make a new django project.<\/p>\n<p style=\"text-align: center;\"><em><strong>django-admin startapp libraryapp<\/strong><\/em><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/django-admin-startapp-libraryapp.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69236\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/django-admin-startapp-libraryapp.png\" alt=\"django admin startapp libraryapp\" width=\"1186\" height=\"105\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/django-admin-startapp-libraryapp.png 1186w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/django-admin-startapp-libraryapp-150x13.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/django-admin-startapp-libraryapp-300x27.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/django-admin-startapp-libraryapp-768x68.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/django-admin-startapp-libraryapp-1024x91.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/django-admin-startapp-libraryapp-520x46.png 520w\" sizes=\"auto, (max-width: 1186px) 100vw, 1186px\" \/><\/a><\/p>\n<p>The project is made by Django. Now, the last command is to make a new application. Move to the directory of manage.py file and make a new app.<\/p>\n<p style=\"text-align: center;\"><em><strong>python manage.py startapp book<\/strong><\/em><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-manage.py-startapp-book.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69237\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-manage.py-startapp-book.png\" alt=\"python manage.py startapp book - Django CRUD\" width=\"1220\" height=\"108\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-manage.py-startapp-book.png 1220w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-manage.py-startapp-book-150x13.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-manage.py-startapp-book-300x27.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-manage.py-startapp-book-768x68.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-manage.py-startapp-book-1024x91.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-manage.py-startapp-book-520x46.png 520w\" sizes=\"auto, (max-width: 1220px) 100vw, 1220px\" \/><\/a><\/p>\n<p>Now, all the required setups are complete. We can proceed further.<\/p>\n<h4>2. Installing Application and Other Important Settings<\/h4>\n<p>To install the app, just add the application\u2019s name in the INSTALLED_APPS list. This is inside <strong>settings.py<\/strong> file.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/INSTALLED_APPS.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69238\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/INSTALLED_APPS.png\" alt=\"INSTALLED_APPS - Django CRUD\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/INSTALLED_APPS.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/INSTALLED_APPS-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/INSTALLED_APPS-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/INSTALLED_APPS-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/INSTALLED_APPS-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/INSTALLED_APPS-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Once you complete this step, we also need to establish the Static Files Settings. Copy these settings as it is and replace it with the existing settings of your project.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># DataFlair Static Files Settings\r\nSTATIC_URL = '\/static\/'\r\nSTATIC_ROOT = os.path.join(BASE_DIR, 'static-files')\r\n#DataFlair #User_Uploaded_Files\r\nMEDIA_URL = 'media\/'\r\nMEDIA_ROOT=os.path.join(BASE_DIR, 'media')<\/pre>\n<p><strong>Code Display:<\/strong><\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Static-Files-Settings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69239\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Static-Files-Settings.png\" alt=\"Static Files Settings - Django CRUD\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Static-Files-Settings.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Static-Files-Settings-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Static-Files-Settings-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Static-Files-Settings-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Static-Files-Settings-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Static-Files-Settings-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Above setting is important for saving and serving static files to the client. Also, we need a pillow package of Python. Install it via command line in your virtual environment.<\/p>\n<p style=\"text-align: center;\"><em><strong>pip install pillow<\/strong><\/em><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-pillow.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69240\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-pillow.png\" alt=\"pip install pillow - Django CRUD\" width=\"1320\" height=\"57\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-pillow.png 1320w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-pillow-150x6.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-pillow-300x13.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-pillow-768x33.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-pillow-1024x44.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/pip-install-pillow-520x22.png 520w\" sizes=\"auto, (max-width: 1320px) 100vw, 1320px\" \/><\/a><\/p>\n<p>Pillow is a Python Imaging Library which deals with different image files. We won\u2019t be using pillow directly but Django is using it. Therefore, we need pillow library.<\/p>\n<p>Okay, now all the preparations for the application are complete. All the settings are done so we can start developing the same.<\/p>\n<h4>3. Making Models for Books App<\/h4>\n<p>In the book folder, open models.py and paste this code. We are making a model or database table for our books app.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from django.db import models\r\n#DataFlair Models\r\nclass Book(models.Model):\r\n    name = models.CharField(max_length = 50)\r\n    picture = models.ImageField()\r\n    author = models.CharField(max_length = 30, default=\u2019anonymous\u2019)\r\n    email = models.EmailField(blank = True)\r\n    describe = models.TextField(default = \u2018DataFlair Django tutorials\u2019)\r\n    def __str__(self):\r\n        return self.name<\/pre>\n<p><strong>Code Display:<\/strong><\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/modelspy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69241\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/modelspy.png\" alt=\"models.py - Django CRUD\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/modelspy.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/modelspy-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/modelspy-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/modelspy-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/modelspy-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/modelspy-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Understanding the Code:<\/strong><\/p>\n<p>From the above code, Django will make a table in a database named book. That table will have these fields:<\/p>\n<p>Name, picture, author, email, and description of the book object. From this class, we can easily manipulate the table. The important part here is the picture field. It is set as <strong>ImageField<\/strong>.<\/p>\n<p>This ImageField is the reason why we installed pillow in this virtual environment. Django by default uses pillow to handle Images in ImageField. So, that was the models of our book app.<\/p>\n<h4>4. Making Model Forms in Book Directory<\/h4>\n<p>Django makes it so much easier to make forms for models. We just need to use our models and we can easily make forms.<\/p>\n<p>Make a new file forms.py in book directory. Paste this code in this forms.py.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from django import forms\r\nfrom .models import Book\r\n#DataFlair\r\nclass BookCreate(forms.ModelForm):\r\n    class Meta:\r\n        model = Book\r\n        fields = '__all__'<\/pre>\n<p><strong>Code Display:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/formspy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69242\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/formspy.png\" alt=\"forms.py - Django CRUD\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/formspy.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/formspy-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/formspy-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/formspy-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/formspy-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/formspy-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Understanding the Code:<\/strong><\/p>\n<p>This is a simple model form we made for book model. Here we import two classes namely, <strong>forms<\/strong> and <strong>Book<\/strong>. The Book is the model we just made.<\/p>\n<p>The <em>BookCreate()<\/em>\u00a0class is the form class which represents the Model form. In the MetaClass, we define which model to be used to make the model form.<\/p>\n<p>Fields denote the actual form fields where we want input from the user. This form is enough for our work.<\/p>\n<h4>5. Registering Model in Django Admin<\/h4>\n<p>Here we are editing <strong>admin.py<\/strong> existing in <strong>book<\/strong> folder. Import the model you want to register in the admin. In this case, it is a Book.<\/p>\n<p>Then paste this line below it.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">admin.site.register(Book)<\/pre>\n<p><strong>Code Display:<\/strong><\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/adminpy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-69243 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/adminpy.png\" alt=\"admin.py - Django CRUD Example\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/adminpy.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/adminpy-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/adminpy-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/adminpy-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/adminpy-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/adminpy-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Okay, so we have made a lot of backend here. To implement all of this, run these commands in the command line:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">python manage.py makemigrations\r\npython manage.py migrate<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/makemigrations.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69244\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/makemigrations.png\" alt=\"makemigrations - crud operations in python django \" width=\"1334\" height=\"313\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/makemigrations.png 1334w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/makemigrations-150x35.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/makemigrations-300x70.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/makemigrations-768x180.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/makemigrations-1024x240.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/makemigrations-520x122.png 520w\" sizes=\"auto, (max-width: 1334px) 100vw, 1334px\" \/><\/a><\/p>\n<p>Our, outputs may not concede. I have already tested it thoroughly.<\/p>\n<p><em>As long as you are following the Django CRUD tutorial, there shall be no errors. If something does arise then tell us in the comments.<\/em><\/p>\n<p>After running these commands, we also need a superuser to login to the admin. You can make a superuser using the command:<\/p>\n<p style=\"text-align: center;\"><em><strong>python manage.py createsuperuser<\/strong><\/em><\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Superuser.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69245\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Superuser.png\" alt=\"Superuser - Django CRUD app\" width=\"1194\" height=\"356\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Superuser.png 1194w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Superuser-150x45.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Superuser-300x89.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Superuser-768x229.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Superuser-1024x305.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Superuser-520x155.png 520w\" sizes=\"auto, (max-width: 1194px) 100vw, 1194px\" \/><\/a><\/p>\n<p>After creating a superuser, you can access the django admin control panel.<\/p>\n<p>We have made models and forms files so far. Now, let\u2019s make the views for our CRUD application.<\/p>\n<h4>6. Making View Functions for Django CRUD App<\/h4>\n<p>The view functions are our actual CRUD operations in Django. Now, we are editing<strong> views.py<\/strong> in <strong>book<\/strong> folder. Open<strong> views.py<\/strong> file in the folder. Paste this code in it:<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from django.shortcuts import render, redirect\r\nfrom .models import Book\r\nfrom .forms import BookCreate\r\nfrom django.http import HttpResponse\r\n\r\n#DataFlair\r\ndef index(request):\r\n    shelf = Book.objects.all()\r\n    return render(request, 'book\/library.html', {'shelf': shelf})\r\n\r\ndef upload(request):\r\n    upload = BookCreate()\r\n    if request.method == 'POST':\r\n        upload = BookCreate(request.POST, request.FILES)\r\n        if upload.is_valid():\r\n            upload.save()\r\n            return redirect('index')\r\n        else:\r\n            return HttpResponse(\"\"\"your form is wrong, reload on &lt;a href = \"{{ url : 'index'}}\"&gt;reload&lt;\/a&gt;\"\"\")\r\nelse:\r\n        return render(request, 'book\/upload_form.html', {'upload_form':upload})\r\n\r\ndef update_book(request, book_id):\r\n    book_id = int(book_id)\r\n    try:\r\n        book_sel = Book.objects.get(id = book_id)\r\n    except Book.DoesNotExist:\r\n        return redirect('index')\r\n    book_form = BookCreate(request.POST or None, instance = book_sel)\r\n    if book_form.is_valid():\r\n       book_form.save()\r\n       return redirect('index')\r\n    return render(request, 'book\/upload_form.html', {'upload_form':book_form})\r\n\r\ndef delete_book(request, book_id):\r\n    book_id = int(book_id)\r\n    try:\r\n        book_sel = Book.objects.get(id = book_id)\r\n    except Book.DoesNotExist:\r\n        return redirect('index')\r\n    book_sel.delete()\r\n    return redirect('index')<\/pre>\n<div id=\"attachment_69246\" style=\"width: 1930px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/views-py-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-69246\" class=\"wp-image-69246 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/views-py-1.png\" alt=\"views.py - django crud app example\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/views-py-1.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/views-py-1-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/views-py-1-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/views-py-1-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/views-py-1-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/views-py-1-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><p id=\"caption-attachment-69246\" class=\"wp-caption-text\">views.py<\/p><\/div>\n<div id=\"attachment_69249\" style=\"width: 1930px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/viewspy-2.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-69249\" class=\"wp-image-69249 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/viewspy-2.png\" alt=\"views.py - crud with django\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/viewspy-2.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/viewspy-2-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/viewspy-2-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/viewspy-2-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/viewspy-2-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/viewspy-2-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><p id=\"caption-attachment-69249\" class=\"wp-caption-text\">views.py<\/p><\/div>\n<p><strong>Understand the Code:<\/strong><\/p>\n<p>There is a lot of information in this file. views.py is one of the main backend components and is the business logic layer. So, let\u2019s understand it step by step.<\/p>\n<p>In this file, we have imported <strong>Book Model<\/strong> and<strong> BookCreate Form.<\/strong><\/p>\n<h4><strong>1. Index Function<\/strong><\/h4>\n<p>This function is performing Read Operation. In this function, we simply retrieve all the objects in the book table. Those objects are then passed to the corresponding template.<\/p>\n<p>We are using Querysets here for that purpose. As discussed in previous articles: Querysets is used to retrieve data from Tables. There are all kinds of filters and usage of Querysets and here we are using:<\/p>\n<p style=\"text-align: center;\"><em><strong>Book.objects.all()<\/strong><\/em><\/p>\n<p>It is clear from the query that it is passing a set of all objects in Book Table.<\/p>\n<p><strong>2. Upload Function<\/strong><\/p>\n<p>This function is <strong>CREATE<\/strong> operation of CRUD. It is simply taking form data from the user and saving it in a database. Since we made a model form for that, we don\u2019t need to validate data again. We can directly save the form info in the database.<\/p>\n<p>We first create the form object. Then we check whether the form is submitting data or user is visiting for the first time.<\/p>\n<p>If the form request method is POST, it means the form is being submitted. You can see, it is also checked whether the form also has an image file or not. The <strong>request.FILES<\/strong> is a dictionary-like object containing the FILES and other information.<\/p>\n<p>Then we check whether the data entered by the user is correct or not. This is done by <strong>form_object.is_clean()<\/strong> method. This will return True or False whether the form_object holds valid data or not.<\/p>\n<p>If the answer is True, we save the form data received in the database. <strong>form_object.save()<\/strong> accomplishes this and since it\u2019s a model form, we can use it directly.<\/p>\n<p>If we receive a GET request then we return an empty form. That\u2019s how we can create an object in the database.<\/p>\n<p><strong>3. Update_book Function<\/strong><\/p>\n<p>The update_book Function is a bit similar to the Update Function. It does more than that though. The update_book function takes in two parameters from the request. The request itself and id number. The id number is used to identify the object which is to be edited.<\/p>\n<p>You can pass it in as a URL or as a cookie. The session method is the most secure but we don\u2019t need to use it here. So, the update_book function will check whether the book_id is valid or not.<\/p>\n<p>If the object exists it will return the form filled with the object\u2019s information in it. The user can change the form again. In this case, there will be no creation of new book but the editing of the existing book object.<\/p>\n<p><strong>4. Delete Function<\/strong><\/p>\n<p>Delete Function is the last function of the CRUD application. We are again using the same object method as with Update book function. We are passing the request and book_id to delete the book.<\/p>\n<p>This is a simpler interpretation of update_book function.<\/p>\n<p>The queryset <strong>book.objects.get(id = book_id)<\/strong> will check for the books having an id equal to book_id. Since book_id is a primary key, we will have only one object returned. We can delete that object easily by just executing:<\/p>\n<p><strong>Book.delete()<\/strong> method. This will delete the book from the database.<\/p>\n<p>So, these were the view functions. Now, we are ready to make the templates and complete our app.<\/p>\n<h4>7. Making Templates<\/h4>\n<p>The first thing you need to do is to make the <strong>templates<\/strong> folder in the <strong>book<\/strong> folder. Inside <strong>book\/templates<\/strong>, make another folder <strong>book<\/strong>. We are going to make all our templates in that folder.<\/p>\n<p>Inside book\/templates\/book, make a new file:<\/p>\n<p style=\"text-align: center;\"><em><strong>library.html<\/strong><\/em><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;\r\n{% load static %}\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;title&gt;Books App&lt;\/title&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.3.1\/css\/bootstrap.min.css\"\r\nintegrity=\"sha384-ggOyR0iXCbMQv3Xipma34MD+dH\/1fQ784\/j6cY\/iJTQUOhcWr7x9JvoRxT2MZw1T\" crossorigin=\"anonymous\"&gt;\r\n&lt;\/head&gt;\r\n&lt;body style=\"background-color:#4DB6AC;\"&gt;\r\n&lt;nav class=\"navbar navbar-light\" style=\"background-color:#FF0033;\"&gt;\r\n    &lt;a href=\"#\" class=\"navbar-brand\" style=\"background-color:#FFCC33;color:#000000;border-width:10px;border-color:#FFCC33;border-style:solid;border-spacing:30px;border-radius: 5px;\"&gt;Library App&lt;\/a&gt;\r\n    &lt;a class=\"navbar-link btn-lg\" href=\"{% url 'index' %}\" style=\"background-color:#FFCC33;color:#000000;\"&gt;DataFlair&lt;\/a&gt;\r\n&lt;a href=\"{% url 'admin:index' %}\" class = 'navbar-link btn-lg' style=\"background-color:#FFCC33;color:#000000;\"&gt;Admin&lt;\/a&gt;\r\n    &lt;a href=\"{% url 'upload-book' %}\" class=\"navbar-link btn-lg\" style=\"background-color:#FFCC33;color:#000000;\"&gt;Upload Books&lt;\/a&gt;\r\n&lt;\/nav&gt;\r\n&lt;br&gt;\r\n{% block content %}\r\n&lt;div class=\"card-columns\"&gt;\r\n    {% for book in shelf %}\r\n    &lt;div class=\"card\" style=\"width: 18rem;\"&gt;\r\n  &lt;img class=\"card-img-top\" src=\"{{ book.picture.url }}\"&gt;\r\n  &lt;div class=\"card-body\"&gt;\r\n    &lt;h5 class=\"card-title\"&gt;{{ book.name }}&lt;\/h5&gt;\r\n    &lt;p class=\"card-text\"&gt;{{ book.describe }}&lt;\/p&gt;\r\n   &lt;div class=\"card-footer bg-transparent border-dark\"&gt;\r\n   &lt;p class=\"card-title\"&gt;{{book.author}}&lt;\/p&gt;\r\n   &lt;center&gt;\r\n       &lt;a href=\"update\/{{book.id}}\" class=\"btn btn-warning\" id = '{{book.id}}'&gt;edit&lt;\/a&gt;\r\n       &lt;a href=\"delete\/{{book.id}}\" class=\"btn btn-danger\" id = '{{book.id}}'&gt;delete&lt;\/a&gt;\r\n    &lt;\/center&gt;\r\n    &lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n&lt;\/div&gt;\r\n    {% endfor %}\r\n&lt;\/div&gt;\r\n{% endblock %}\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/library-html.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69252\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/library-html.png\" alt=\"library.html\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/library-html.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/library-html-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/library-html-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/library-html-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/library-html-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/library-html-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Understanding the Code:<\/strong><\/p>\n<p>It\u2019s a simple template file where we are displaying objects from a database. We are running a for loop to access the data in the dictionary we passed. All the other things are CSS and some Bootstrap Framework.<\/p>\n<p style=\"text-align: center;\"><strong>Upload_form.html<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">{% extends 'book\/library.html' %}\r\n{% block content %}\r\n    &lt;center&gt;\r\n    &lt;h1 class=\"display-3\" style=\"background-color:#000000;color:#FFFF99;\"&gt;Upload Books&lt;\/h1&gt;\r\n    &lt;form method = 'POST' enctype=\"multipart\/form-data\"&gt;\r\n        {% csrf_token %}\r\n        &lt;table class = 'w-50 table table-light' style=\"border-radius:10px;background-color:#FFFF99;\"&gt;\r\n            {% for field in upload_form %}\r\n            &lt;tr&gt;\r\n                &lt;th&gt;{{field.label}}&lt;\/th&gt;\r\n                &lt;td&gt;{{ field }}&lt;\/td&gt;\r\n            &lt;\/tr&gt;\r\n            {% endfor %}\r\n        &lt;\/table&gt;\r\n        &lt;button type=\"submit\" class=\"btn btn-lg btn-warning\"&gt;Submit&lt;\/button&gt;\r\n    &lt;\/form&gt;\r\n&lt;\/center&gt;\r\n{% endblock %}<\/pre>\n<p><strong>Code Display:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/upload_form-html.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69253\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/upload_form-html.png\" alt=\"upload_form.html - django crud application example\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/upload_form-html.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/upload_form-html-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/upload_form-html-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/upload_form-html-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/upload_form-html-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/upload_form-html-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Understanding the Code:<\/strong><\/p>\n<p>This is a typical form rendering template. We are using csrf token and other form tags. Here I am printing the form fields via for loop. This can be done in another way directly. It depends on how you want to render it in frontend.<\/p>\n<h4>8. Configuring URLs<\/h4>\n<p>Now, we need to configure the urls file. Paste this code as it is in the mentioned urls files. If the file doesn\u2019t exist then make one and copy the whole thing.<\/p>\n<p style=\"text-align: center;\"><strong>Urls.py<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from django.contrib import admin\r\nfrom django.urls import path, include\r\n#DataFlair\r\nurlpatterns = [\r\n    path('admin\/', admin.site.urls),\r\n    path('', include('book.urls'))\r\n]<\/pre>\n<p style=\"text-align: left;\"><strong>Code Display:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/urlspy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69254\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/urlspy.png\" alt=\"urls.py - python django crud tutorial\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/urlspy.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/urlspy-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/urlspy-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/urlspy-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/urlspy-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/urlspy-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><strong>Book\/urls.py<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from django.urls import path\r\nfrom . import views\r\nfrom libraryapp.settings import DEBUG, STATIC_URL, STATIC_ROOT, MEDIA_URL, MEDIA_ROOT\r\nfrom django.conf.urls.static import static\r\n\r\nurlpatterns = [\r\n    path('', views.index, name = 'index'),\r\n    path('upload\/', views.upload, name = 'upload-book'),\r\n    path('update\/&lt;int:book_id&gt;', views.update_book),\r\n    path('delete\/&lt;int:book_id&gt;', views.delete_book)\r\n]\r\n\r\n#DataFlair\r\nif DEBUG:\r\n    urlpatterns += static(STATIC_URL, document_root = STATIC_ROOT)\r\n    urlpatterns += static(MEDIA_URL, document_root = MEDIA_ROOT)\r\n<\/pre>\n<p style=\"text-align: left;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/book-urlspy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69255\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/book-urlspy.png\" alt=\"book-urls.py - crud python django \" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/book-urlspy.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/book-urlspy-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/book-urlspy-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/book-urlspy-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/book-urlspy-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/book-urlspy-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>This file contains all the URL lookups for library app as well as settings for Django static files. These settings are used by Django to render the images with the book object.<\/p>\n<h4>9. Running Server and Testing<\/h4>\n<p>At last, the fun part. To test the website, start your server by:<\/p>\n<p style=\"text-align: center;\"><em><strong>python manage.py runserver<\/strong><\/em><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-managepy-runserver.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69256\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-managepy-runserver.png\" alt=\"python manage.py runserver\" width=\"1541\" height=\"275\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-managepy-runserver.png 1541w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-managepy-runserver-150x27.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-managepy-runserver-300x54.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-managepy-runserver-768x137.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-managepy-runserver-1024x183.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-managepy-runserver-520x93.png 520w\" sizes=\"auto, (max-width: 1541px) 100vw, 1541px\" \/><\/a><\/p>\n<p>Now, open the URL:<\/p>\n<p style=\"text-align: center;\">\u00a0<strong><em>http:\/\/127.0.0.1:8000\/<\/em><\/strong><\/p>\n<p>You can see a page like this.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Home-page.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69257\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Home-page.png\" alt=\"Home page - Django CRUD Example\" width=\"1920\" height=\"943\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Home-page.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Home-page-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Home-page-300x147.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Home-page-768x377.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Home-page-1024x503.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Home-page-520x255.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Since I have already populated my data, it comes out like this.<\/p>\n<p>Click on <strong>Upload book<\/strong> link on the top-right corner of the screen.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Upload-book.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69258\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Upload-book.png\" alt=\"Upload books - Django CRUD Application\" width=\"1920\" height=\"943\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Upload-book.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Upload-book-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Upload-book-300x147.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Upload-book-768x377.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Upload-book-1024x503.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Upload-book-520x255.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Here you can fill out the book information and submit it. If your book update is successful you should see a new edition on your homepage.<\/p>\n<p>Now, taking the book objects from the homepage. Click on the edit button of one of the books.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Click-on-edit.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69259\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Click-on-edit.png\" alt=\"Click on edit - Django CRUD App\" width=\"1920\" height=\"943\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Click-on-edit.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Click-on-edit-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Click-on-edit-300x147.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Click-on-edit-768x377.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Click-on-edit-1024x503.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Click-on-edit-520x255.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>As you will see, we will have a form filled with books information.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Book-information-form.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69260\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Book-information-form.png\" alt=\"Book information form - Django CRUD Application\" width=\"1920\" height=\"943\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Book-information-form.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Book-information-form-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Book-information-form-300x147.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Book-information-form-768x377.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Book-information-form-1024x503.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Book-information-form-520x255.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>You can now change the information accordingly and submit again. This will change the data in the database.<\/p>\n<p>Lastly, when you click the <strong>delete<\/strong> button in a book object, the book will be deleted from the database.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Deleted-book.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69263\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Deleted-book.png\" alt=\"Deleted book\" width=\"1920\" height=\"943\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Deleted-book.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Deleted-book-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Deleted-book-300x147.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Deleted-book-768x377.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Deleted-book-1024x503.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Deleted-book-520x255.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Now, there are only two books in the database. All these changes are occurring at the level of the database.<\/p>\n<h3>Summary<\/h3>\n<p>Lastly, you have a working prototype of a library app. Enhance it more or make something new using the basic CRUD operations in Django. The CRUD operations make it much easier for you to implement website solutions.<\/p>\n<p>You can get the code for this project from:<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/github.com\/Karan-S-Mittal\/LibraryApp.git\">Library App Project<\/a><\/p>\n<p>Download the app from there and change some database settings.<\/p>\n<p>Then you can run this app or follow the tutorial here itself to understand things better.<\/p>\n<p>Any kind of confusion in Django CRUD tutorial? Mention your queries in the comment section. The DataFlair team will assist you in the best possible way.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1416,&quot;href&quot;:&quot;https:\\\/\\\/github.com\\\/Karan-S-Mittal\\\/LibraryApp.git&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;https:\\\/\\\/github.com\\\/Karan-S-Mittal\\\/LibraryApp&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Django CRUD tutorial &#8211; Django is an amazing framework.\u00a0Now, it\u2019s time to make a web application using newly gained skills. We will discuss some important concepts required while making an application. In this tutorial,&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":69320,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19149],"tags":[21029,21028,21027,21026,21030],"class_list":["post-69227","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-django","tag-books-app","tag-crud-application","tag-crud-operations","tag-django-crud","tag-view-functions"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Django CRUD Tutorial - Operations and Application Development - DataFlair<\/title>\n<meta name=\"description\" content=\"Django CRUD tutorial - Learn about CRUD operations &amp; process to make a CRUD application using Django framework with easy steps &amp; code examples to implement.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/django-crud-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Django CRUD Tutorial - Operations and Application Development - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Django CRUD tutorial - Learn about CRUD operations &amp; process to make a CRUD application using Django framework with easy steps &amp; code examples to implement.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/django-crud-example\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-07T11:56:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-21T06:49:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Django-CRUD-Tutorial.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"17 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Django CRUD Tutorial - Operations and Application Development - DataFlair","description":"Django CRUD tutorial - Learn about CRUD operations & process to make a CRUD application using Django framework with easy steps & code examples to implement.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/django-crud-example\/","og_locale":"en_US","og_type":"article","og_title":"Django CRUD Tutorial - Operations and Application Development - DataFlair","og_description":"Django CRUD tutorial - Learn about CRUD operations & process to make a CRUD application using Django framework with easy steps & code examples to implement.","og_url":"https:\/\/data-flair.training\/blogs\/django-crud-example\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2019-09-07T11:56:47+00:00","article_modified_time":"2021-06-21T06:49:20+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Django-CRUD-Tutorial.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"17 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/django-crud-example\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/django-crud-example\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"Django CRUD Tutorial &#8211; Operations and Application Development","datePublished":"2019-09-07T11:56:47+00:00","dateModified":"2021-06-21T06:49:20+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/django-crud-example\/"},"wordCount":2155,"commentCount":31,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/django-crud-example\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Django-CRUD-Tutorial.jpg","keywords":["Books App","CRUD Application","CRUD Operations","Django CRUD","view Functions"],"articleSection":["Django Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/django-crud-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/django-crud-example\/","url":"https:\/\/data-flair.training\/blogs\/django-crud-example\/","name":"Django CRUD Tutorial - Operations and Application Development - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/django-crud-example\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/django-crud-example\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Django-CRUD-Tutorial.jpg","datePublished":"2019-09-07T11:56:47+00:00","dateModified":"2021-06-21T06:49:20+00:00","description":"Django CRUD tutorial - Learn about CRUD operations & process to make a CRUD application using Django framework with easy steps & code examples to implement.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/django-crud-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/django-crud-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/django-crud-example\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Django-CRUD-Tutorial.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Django-CRUD-Tutorial.jpg","width":802,"height":420,"caption":"Django CRUD Tutorial"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/django-crud-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Django Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/django\/"},{"@type":"ListItem","position":3,"name":"Django CRUD Tutorial &#8211; Operations and Application Development"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/69227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=69227"}],"version-history":[{"count":6,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/69227\/revisions"}],"predecessor-version":[{"id":97560,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/69227\/revisions\/97560"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/69320"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=69227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=69227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=69227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}