{"id":1978,"date":"2026-07-22T00:16:34","date_gmt":"2026-07-21T17:16:34","guid":{"rendered":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/22\/how-to-build-a-simple-crud-app-with-django-a-step-by-step-tutorial\/"},"modified":"2026-07-22T00:16:34","modified_gmt":"2026-07-21T17:16:34","slug":"how-to-build-a-simple-crud-app-with-django-a-step-by-step-tutorial","status":"publish","type":"post","link":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/22\/how-to-build-a-simple-crud-app-with-django-a-step-by-step-tutorial\/","title":{"rendered":"How to Build a Simple CRUD App with Django: A Step-by-Step Tutorial"},"content":{"rendered":"<h1>How to Build a Simple CRUD App with Django: A Step-by-Step Tutorial<\/h1>\n<p>Django\u2019s \u201cbatteries-included\u201d philosophy makes creating a CRUD (Create, Read, Update, Delete) application remarkably straightforward. In this tutorial, you\u2019ll build a basic task manager that allows users to add, view, edit, and delete tasks. No prior Django experience is required, but you should have Python installed.<\/p>\n<p>Start by creating a Django project and a dedicated app. Run <code>django-admin startproject todo_project<\/code>, then <code>cd todo_project<\/code> and <code>python manage.py startapp tasks<\/code>. Register the app in <code>settings.py<\/code> by adding <code>'tasks'<\/code> to <code>INSTALLED_APPS<\/code>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/via.placeholder.com\/800x600\/4a90d9\/ffffff?text=how%20to%20create%20a%20simple%20CRUD%20app%20with%20Django\" alt=\"Article illustration\" style=\"display:block;margin:20px auto;max-width:100%;height:auto;border-radius:8px;\" \/><\/p>\n<h2>1. Define the Model<\/h2>\n<p>Open <code>tasks\/models.py<\/code> and create a simple model:<\/p>\n<ul>\n<li><code>title<\/code>: <code>CharField(max_length=200)<\/code><\/li>\n<li><code>completed<\/code>: <code>BooleanField(default=False)<\/code><\/li>\n<\/ul>\n<p>Run <code>python manage.py makemigrations<\/code> and <code>migrate<\/code> to create the database table.<\/p>\n<h2>2. Build the Views and URLs<\/h2>\n<p>Use Django\u2019s generic class\u2011based views for clean code. In <code>tasks\/views.py<\/code>:<\/p>\n<ul>\n<li><code>TaskListView<\/code> \u2013 lists all tasks<\/li>\n<li><code>TaskCreateView<\/code> \u2013 form to add a task<\/li>\n<li><code>TaskUpdateView<\/code> \u2013 edit an existing task<\/li>\n<li><code>TaskDeleteView<\/code> \u2013 confirm deletion<\/li>\n<\/ul>\n<p>Create a <code>urls.py<\/code> file in the <code>tasks<\/code> folder and wire these views to URL patterns, then include them in the project\u2019s main <code>urls.py<\/code>.<\/p>\n<h2>3. Create Templates<\/h2>\n<p>Inside <code>tasks\/templates\/tasks\/<\/code>, create four files:<\/p>\n<ul>\n<li><code>task_list.html<\/code> \u2013 displays all tasks with edit\/delete links<\/li>\n<li><code>task_form.html<\/code> \u2013 handles both create and update actions<\/li>\n<li><code>task_confirm_delete.html<\/code> \u2013 delete confirmation page<\/li>\n<\/ul>\n<p>Use Django\u2019s <code>{% extends %}<\/code> and <code>{{ form.as_p }}<\/code> to keep templates minimal.<\/p>\n<h2>4. Test Your CRUD Operations<\/h2>\n<p>Run the development server with <code>python manage.py runserver<\/code>. Visit <code>\/tasks\/<\/code> to see an empty list. Use the \u201cAdd\u201d link to create a task, edit it, and delete it. Every action updates the database instantly.<\/p>\n<p><strong>Conclusion<\/strong>: You\u2019ve built a fully functional CRUD app in minutes. Django\u2019s generic views and ORM handle the heavy lifting, letting you focus on customizing behavior. Extend this by adding authentication, styling with Bootstrap, or filtering tasks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Build a Simple CRUD App with Django: A Step-by-Step Tutorial Django\u2019s \u201cbatteries-included\u201d philosophy makes creating a CRUD (Create, Read, Update, Delete) application remarkably straightforward. In this tutorial, you\u2019ll build a basic task manager that allows users to add, view, edit, and delete tasks. No prior Django experience is required, but you should have &hellip; <\/p>\n","protected":false},"author":2716,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-1978","post","type-post","status-publish","format-standard","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/1978","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/users\/2716"}],"replies":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/comments?post=1978"}],"version-history":[{"count":0,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/1978\/revisions"}],"wp:attachment":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}