Showing posts from February, 2019

Django CRUD (Create, Retrieve, Update, Delete)

One of the most common task when developing web application is to write create, read, update and delete functionality (CRUD) for each table you have. In this post I briefly cover the step needed to create a CRUD app in Django, the steps we will need are: Install Django & start new projectCreate an AppCreate the ModelCreate the Admin Interface (optional)Create the ViewDefine the URLs (i.e. URL to View mapping)Create the Templates Install Django and Start New Project First we need to install Django and start new Django project, I’ll name it my_proj: pip install django django-admin startproject my_proj cd my_proj Create new App From the Django project directory we will create the new app called “books” to store our books collection: ./ startapp books We will also need to register the new app in our Django project, add the app “books” to the INSTALLED_APPS in your my_proj/ INSTALLED_APPS = ( : 'books', : ) Create the Model The model file would …