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
Articles on Trending Technologies
Technical articles with clear explanations and examples
Smooth profiling in Django
In this article, we are going to implement Django profiling using django-silk. This tool provides detailed information about your application's performance, including GET requests, database queries, and other essential metrics for monitoring your website in production environments. Django Silk is particularly valuable for real-world project deployments where performance monitoring is critical. Installation First, create a Django project and app with basic settings configured. Then install the django-silk package ? pip install django-silk Configuration Settings Configuration In your settings.py, add the following configuration ? MIDDLEWARE = [ ...
Read MoreDjango – Showing model data directly into table with sorting and pagination
In this article, we will see how to make a table in Django which will render model data. We are not going to use the standard tag of HTML. We will use the django_tables2 library which provides features to directly show Django model data in a table with sorting and pagination. Installing django_tables2 First, install the django_tables2 package ? pip install django_tables2 Add it to your settings.py ? INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', ...
Read MoreQR code generating website in Django
We sometimes need to generate QR codes for URLs in our Django websites. QR codes are scanned for verification, website login, opening websites and many other purposes. In this article, we will see how to implement a QR code generator website in Django. Setting Up the Django Project First, create a Django project and an app. Create a media folder at the same level as your project and app directories. Go to settings.py in the project folder and add the app name in INSTALLED_APPS and add this at the bottom − MEDIA_ROOT = os.path.join(BASE_DIR, 'media/') ...
Read MoreModel object's history tracking in Django
Model history tracking in Django allows you to track changes made to model objects, including what changes were made, when they occurred, and helps in recovery of deleted objects. The django-simple-history package provides an easy way to implement this functionality. Installation and Setup First, install the django-simple-history library ? pip install django-simple-history Add the package to your Django settings in settings.py ? INSTALLED_APPS = [ # other apps 'simple_history', ] MIDDLEWARE = [ # other middleware ...
Read MoreHow to add an UpdateView in Django?
Django's UpdateView is a built-in class-based view that simplifies updating model data from the frontend. It acts like an admin interface for editing existing records. In this tutorial, we'll create a complete example demonstrating how to implement UpdateView for a Student model. Project Setup First, create a Django project and app. Add the app to your settings and configure URLs ? settings.py INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ...
Read MoreHow 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 More