Implement Search Autocomplete For Input Fields in Django
Django is a high-level Python based Web Framework that allows rapid development and clean, pragmatic design. It is also called batteries included framework because Django provides built-in features for everything including Django Admin Interface, default database – SQLlite3, etc. Today we will create joke app in django.
In this article we will learn how to fetch data from django models and give it feature like autocomplete. We will be using jquery for autocompletion.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
pip3 install django
First we will create new project
django-admin startproject AutoC
Then we will create new app
python3 manage.py startapp main
Then add the app name in settings.py inside the INSTALLED_APPS
Then to create database table we have to makemigrations
python3 manage.py makemigrations
python3 manage.py migrate
I have added this languages in the table.
Then create new directory inside app template inside that create another directory main
Then create new file index.html
Then create new file urls.py
Then add the app/urls inside our project/urls
Then to run this app
python manage.py runserver
python3 manage.py runserver