Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Server Side Programming Articles
Page 356 of 2109
How to add a text editor field in Django?
Many online exam platforms and content management systems use rich text editors for text entries, image uploading, and formatted content creation. Quill is a popular WYSIWYG text editor that provides a Django model field to directly store rich content in the database without extra configuration. In this article, we will see how to implement a rich text editor field in Django using django-quill-editor. Installation and Setup First, create a Django project and app with basic configuration. Install the django-quill-editor package ? pip install django-quill-editor In settings.py, add the required configuration ? ...
Read MoreMaking your own custom filter tags in Django
Django provides many built-in template filters, but you can also create custom filters to extend functionality. Custom filters allow you to process data in templates using your own logic, such as formatting text or performing calculations. In this article, we will learn how to create and use custom template filters in Django. Project Setup First, create a Django project and app with the following structure ? tutorial/ (project) ├── example/ (app) │ ├── templates/ │ │ └── home.html │ ...
Read MoreDjango – Making a Django website more human-like using Humanizer
In this article, we will see what is humanizer and how to use it in Django. Humanizer is a built-in Django filter that adds a human touch to your project by converting raw data into more readable formats. It's one of the most useful template filters in Django. Humanizer helps convert numbers from numerical figures to words, add commas between large numbers, or convert numbers to readable formats like million or billion. Let's create a Django project to demonstrate its usage. Project Setup First, create a Django project and an app, then configure the project URLs − ...
Read MoreAdding a DeleteView in Django
A DeleteView is a Django generic view that provides an easy way to delete model instances from your application. It handles the deletion logic and provides confirmation functionality, similar to Django's admin interface. Setting Up the Project First, create a Django project and app. Add your app to settings.py − INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'modelFormsDemo', # Your app name ] ...
Read MoreHow to make a Country field in Django?
If you need to add a location field in your form or database, you can use a CharField but it's not the ideal solution. Django provides a third-party package called 'django-countries' that offers a dedicated country field with built-in validation and country list management. In this article, let's see how to use django-countries to add a Country field in Django. Installation and Setup First, create a Django project and an app. Add the app in INSTALLED_APPS and set up URLs. Install the django-countries module ? pip install django-countries In settings.py, add this ? ...
Read MoreHow to add a captcha in a Django website?
CAPTCHA is a security feature used to verify that users are human, not bots. Django provides an easy way to implement CAPTCHA using the django-simple-captcha library, which generates image-based challenges for user verification. In this article, we'll learn how to add CAPTCHA functionality to a Django website step by step. Installation First, install the required library − pip install django-simple-captcha Django Configuration Settings Configuration Add the CAPTCHA app to your settings.py − INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', ...
Read MoreMaking a URL shortner app in Django
In this article, we will see how to make a URL shortener app in Django. It is a simple app which will convert a long URL into a short one using the pyshorteners library. First, create a Django project and an app. Do some basic settings like including URLs of app and adding the app to INSTALLED_APPS in settings.py. Installing Required Package Install the pyshorteners module − pip install pyshorteners Setting Up URLs In app's urls.py − from django.urls import path from .views import url_shortener urlpatterns = [ ...
Read MoreMaking a simple counter app using request.session in Django
In this article, we are going to see how to make a super simple counter app using Django sessions. By clicking a button, the counter increments and persists even after closing the browser tab. This demonstrates how to use request.session for state management in Django. Setting Up URLs In urls.py, add the following lines − from django.urls import path from . import views urlpatterns = [ path('', views.counterView, name='counter'), ] Here we set up the counter view on the home URL. Creating the View In views.py, add ...
Read MoreMaking a Pickle field in Django models
Pickle in Python is primarily used in serializing and deserializing a Python object structure. In other words, it's the process of converting a Python object into a byte stream to store it in a file/database, maintain program state across sessions, or transport data over the network. In this article, we are going to see how to make a Django field which will save pickle objects. We will work with models.py and Django shell to demonstrate the functionality. Installation First, install the django-picklefield package − pip install django-picklefield Creating the Model In models.py ...
Read MoreDjango – Making a contact form and storing its data without model, query and html
In Django, creating a contact form typically requires managing forms, views, models, and admin registration. However, you can simplify this process using the django-contactforms package, which provides a predefined contact form and model without writing custom code in models.py, views.py, or HTML templates. Installation and Setup First, create a Django project and app, then install the required package: pip install django-contactforms Add the package to your settings.py: INSTALLED_APPS += ["contactforms"] URL Configuration In your project's urls.py, configure the URL patterns: from django.contrib import admin from django.urls import ...
Read More