Home > Article > Backend Development > CRUD Operations In Python & Django - Part 2
In our previous article, we covered the basics of setting up a Django project and created our Exercise model, which we displayed on the front end as a list. In this article, we’ll dive into performing CRUD operations. For those unfamiliar, CRUD stands for Create, Read, Update, and Delete—essentially the four fundamental actions you can perform on your data.
Now that we have our API set up in the app folder, we’ll simply extend the index view to handle create, update, and delete requests.
Let’s set up a form that allows users to create exercises. We’ll be using HTML templates for this purpose once again. To get started, create a new template called add_exercise.html in the app/templates folder.
<form method="POST" action="/"> {% csrf_token %} <input type="text" name="title" placeholder="Enter the title" /> <input type="date" name="date" placeholder="Enter the date" /> <button type="submit">Save</button> </form>
Next, in our index.html template, we’ll include the add_exercise.html template using the following method:
{% extends "base.html" %} {% block content %} <h2>Exercises</h2> {% include 'add_exercise.html' %} ... {% endblock %}
We’re utilizing the include tag here, which promotes composability across HTML templates, making our code easier to maintain and understand. If you refresh the page in your browser, you should see the form appear on the screen.
In our HTML, we're using the