<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shivam Rohilla</title>
    <description>The latest articles on DEV Community by Shivam Rohilla (@shivamrohilla).</description>
    <link>https://dev.to/shivamrohilla</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F592325%2F0a242318-1c7b-4119-aff8-61361e6a04da.jpeg</url>
      <title>DEV Community: Shivam Rohilla</title>
      <link>https://dev.to/shivamrohilla</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shivamrohilla"/>
    <language>en</language>
    <item>
      <title>Judiro AI: India’s Smart Legal AI for Lawyers, Advocates &amp; Legal Professionals | Using DjangoRestFramework &amp; Tailwind CSS</title>
      <dc:creator>Shivam Rohilla</dc:creator>
      <pubDate>Tue, 20 Jan 2026 20:39:27 +0000</pubDate>
      <link>https://dev.to/shivamrohilla/judiro-ai-indias-smart-legal-ai-for-lawyers-advocates-legal-professionals-using-18db</link>
      <guid>https://dev.to/shivamrohilla/judiro-ai-indias-smart-legal-ai-for-lawyers-advocates-legal-professionals-using-18db</guid>
      <description>&lt;p&gt;The Indian legal ecosystem is evolving fast — and AI is no longer optional.&lt;br&gt;
&lt;a href="https://judiro.com/&amp;lt;br&amp;gt;%0A![%20](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4pt7py85vjysirtdvem0.png)" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Meet Judiro AI, a next-gen Legal AI platform built for Indian lawyers, advocates, and law firms.&lt;/p&gt;

&lt;p&gt;Judiro AI is designed to help legal professionals draft faster, research smarter, and work efficiently using Artificial Intelligence.&lt;/p&gt;

&lt;p&gt;🔍 What is Judiro AI?&lt;/p&gt;

&lt;p&gt;Judiro AI is an AI-powered legal assistant built using modern backend architecture (Django Rest Framework) and a fast, responsive frontend (Tailwind CSS), optimized for performance, scalability, and real-world legal use cases.&lt;/p&gt;

&lt;p&gt;If you’re searching for:&lt;br&gt;
    • Legal AI in India&lt;br&gt;
    • AI Lawyer platform&lt;br&gt;
    • AI Advocate tools&lt;br&gt;
    • AI for legal drafting&lt;br&gt;
    • Indian legal AI software&lt;/p&gt;

&lt;p&gt;👉 Judiro AI is built exactly for that.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;🧠 How Judiro AI Helps Lawyers &amp;amp; Advocates&lt;/p&gt;

&lt;p&gt;Judiro AI assists legal professionals in:&lt;br&gt;
    • AI Legal Drafting (NDAs, Agreements, Legal Notices, Contracts)&lt;br&gt;
    • Clause generation &amp;amp; improvement&lt;br&gt;
    • Legal language correction&lt;br&gt;
    • Time-saving document automation&lt;br&gt;
    • AI-powered legal assistance for Indian law&lt;/p&gt;

&lt;p&gt;Unlike generic AI tools, Judiro AI focuses on Indian legal workflows, making it practical for advocates, law firms, and legal startups.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;⚙️ Technology Behind Judiro AI&lt;/p&gt;

&lt;p&gt;Judiro AI is built with a modern, scalable tech stack:&lt;br&gt;
    • Django Rest Framework (DRF) for secure and scalable APIs&lt;br&gt;
    • Tailwind CSS for fast, clean, and responsive UI&lt;br&gt;
    • AI models for legal reasoning, drafting assistance, and productivity&lt;/p&gt;

&lt;p&gt;This ensures:&lt;br&gt;
    • Fast response times&lt;br&gt;
    • Secure handling of legal data&lt;br&gt;
    • Scalable architecture for future legal AI features&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;🇮🇳 Built for Indian Legal System&lt;/p&gt;

&lt;p&gt;Most AI lawyer tools are global and generic.&lt;br&gt;
Judiro AI is different.&lt;/p&gt;

&lt;p&gt;It is built keeping in mind:&lt;br&gt;
    • Indian legal terminology&lt;br&gt;
    • Advocate workflows&lt;br&gt;
    • Indian contracts &amp;amp; agreements&lt;br&gt;
    • Practical use cases for Indian courts &amp;amp; law firms&lt;/p&gt;

&lt;p&gt;If you are an Indian advocate looking for an AI legal assistant, Judiro AI is built for you.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;🚀 Why Judiro AI Matters&lt;/p&gt;

&lt;p&gt;Lawyers don’t need replacement.&lt;br&gt;
They need leverage.&lt;/p&gt;

&lt;p&gt;Judiro AI helps advocates:&lt;br&gt;
    • Save drafting time&lt;br&gt;
    • Reduce repetitive work&lt;br&gt;
    • Focus on strategy, clients, and court work&lt;/p&gt;

&lt;p&gt;AI doesn’t replace lawyers —&lt;br&gt;
AI empowers lawyers who use it early.&lt;/p&gt;

&lt;p&gt;Legal AI&lt;br&gt;
AI Lawyer India&lt;br&gt;
AI Advocate&lt;br&gt;
Legal AI India&lt;br&gt;
AI for Lawyers&lt;br&gt;
AI Legal Drafting&lt;br&gt;
Indian Legal AI&lt;br&gt;
Judiro AI&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>django</category>
      <category>python</category>
    </item>
    <item>
      <title>How to store users location in django using GeoDjango</title>
      <dc:creator>Shivam Rohilla</dc:creator>
      <pubDate>Wed, 31 Jan 2024 09:19:02 +0000</pubDate>
      <link>https://dev.to/shivamrohilla/how-to-store-users-location-in-django-using-geodjango-5ej2</link>
      <guid>https://dev.to/shivamrohilla/how-to-store-users-location-in-django-using-geodjango-5ej2</guid>
      <description>&lt;p&gt;Hello devs, In this blog we'll learn about storing user location in django with the longitude and latitude and for that we will use GeoDjango, Django provides a framework called GeoDjango, and with the help of GeoDjango we can store the user location parameters (Latitude and Longitude), and point the user location on map in django admin.&lt;/p&gt;

&lt;p&gt;So, basically I'm storing the user location and the parameter in django while signup or user creation, and with the help of that we can know the user exact location.&lt;/p&gt;

&lt;p&gt;and for storing the user location with django, we are using Postgresql database, which provides postgis extension, and supports the user location functionality, and I'm using Mac, so, please manage the Postgis path and extension according to your OS, so let's start code now:-&lt;/p&gt;

&lt;h1&gt;
  
  
  Post link for source code
&lt;/h1&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

How To Store Users Location In Django Using Geodjango pythondjangogeek.com


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Geo Django and Postgresql Installation
&lt;/h3&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

brew install postgres
brew install postgis


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;h4&gt;
  
  
  download the postgres app from this link:-
&lt;/h4&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

https://postgresapp.com/downloads.html


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Installing Geospatial Libraries
&lt;/h3&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

brew install gdal
brew install geos
brew install libgeoip


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;add library path in django setting.py file&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

GDAL_LIBRARY_PATH = '/opt/homebrew/Cellar/gdal/3.8.3/lib/libgdal.dylib'
GEOS_LIBRARY_PATH = '/opt/homebrew/Cellar/geos/3.12.1/lib/libgeos_c.dylib'



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Setting up Django project
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

django-admin startproject userlocation


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  and now mention postgis in settings.py
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.gis',
    'rest_framework.authtoken',
    'rest_framework',
    'users'
]



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Now, we will create models.py
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

from django.contrib.auth.models import User
from django.contrib.gis.db import models


class Customer(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='user_profile')
    name = models.CharField(max_length=100)
    location = models.PointField(blank=True, null=True)
    longitude = models.FloatField()
    latitude = models.FloatField()

    def __str__(self):
        return self.name




&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;ww'll store user longitude and latitude and also location with the PointField, this field will show the map on Django admin like this:- &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fix83zg1zra307zqw3mgd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fix83zg1zra307zqw3mgd.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Admin.py file
&lt;/h2&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

from django.contrib import admin
from .models import Customer
from django.contrib.gis.admin import OSMGeoAdmin


@admin.register(Customer)
class CustomerAdmin(OSMGeoAdmin):
    list_display = ['id', 'name', 'user', 'location', 'longitude', 'latitude']
    search_fields = ['name', 'user__username']


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Serializers.py file
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

from rest_framework import serializers
from django.contrib.auth.models import User
from .models import Customer

class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = ['username', 'password', 'email']

class CustomerSerializer(serializers.ModelSerializer):
    user = UserSerializer()

    class Meta:
        model = Customer
        fields = ['id', 'user', 'name', 'location', 'longitude', 'latitude']


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Views.py file
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

from rest_framework import generics
from rest_framework.response import Response
from rest_framework import status
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from rest_framework.authtoken.models import Token
from django.contrib.gis.geos import Point
from .models import Customer
from .serializers import CustomerSerializer, UserSerializer

class CustomerListCreateView(generics.ListCreateAPIView):
    queryset = Customer.objects.all()
    serializer_class = CustomerSerializer

    def create(self, request, *args, **kwargs):
        user_serializer = UserSerializer(data=request.data.get('user'))
        customer_serializer = self.get_serializer(data=request.data)

        user_serializer.is_valid(raise_exception=True)
        customer_serializer.is_valid(raise_exception=True)

        # Create User instance
        user = User.objects.create_user(**user_serializer.validated_data)

        # Extract latitude and longitude from the request data
        latitude = request.data.get('latitude', None)
        longitude = request.data.get('longitude', None)

        # Check if both latitude and longitude are present
        if latitude is not None and longitude is not None:
            # Create a Point object with the given latitude and longitude
            location = Point(float(longitude), float(latitude))
            customer_serializer.validated_data['location'] = location

        # Create Customer instance
        customer_serializer.validated_data['user'] = user
        self.perform_create(customer_serializer)

        # Create and return token
        token, created = Token.objects.get_or_create(user=user)


        headers = self.get_success_headers(customer_serializer.data)
        return Response({'token': token.key, **customer_serializer.data}, status=status.HTTP_201_CREATED, headers=headers)

class CustomerDetailView(generics.RetrieveUpdateDestroyAPIView):
    queryset = Customer.objects.all()
    serializer_class = CustomerSerializer

class UserLoginView(generics.CreateAPIView):
    serializer_class = UserSerializer

    def create(self, request, *args, **kwargs):
        username = request.data.get('username', '')
        password = request.data.get('password', '')

        user = authenticate(request, username=username, password=password)

        if user is not None:
            login(request, user)
            token, created = Token.objects.get_or_create(user=user)
            serializer = UserSerializer(user)
            return Response({'token': token.key, **serializer.data})
        else:
            return Response({'detail': 'Invalid credentials'}, status=status.HTTP_401_UNAUTHORIZED)



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  URLs.py file
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

from django.urls import path
from .views import CustomerListCreateView, CustomerDetailView, UserLoginView

urlpatterns = [
    path('customers/', CustomerListCreateView.as_view(), name='customer-list-create'),
    path('customers/&amp;lt;int:pk&amp;gt;/', CustomerDetailView.as_view(), name='customer-detail'),
    path('login/', UserLoginView.as_view(), name='user-login'),
]


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;so, that's how you can implement the user location in django using GeoDjango, and you can connect with me.&lt;/p&gt;

&lt;p&gt;Thank You.&lt;br&gt;
Shivam Rohilla | Python Developer&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to use Redis in Django to optimize Your Django Performance</title>
      <dc:creator>Shivam Rohilla</dc:creator>
      <pubDate>Fri, 13 Oct 2023 07:38:19 +0000</pubDate>
      <link>https://dev.to/shivamrohilla/how-to-use-redis-in-django-to-optimize-your-django-performance-51aa</link>
      <guid>https://dev.to/shivamrohilla/how-to-use-redis-in-django-to-optimize-your-django-performance-51aa</guid>
      <description>&lt;p&gt;Hello Devs, In this Post we'll learn about Redis and Django, Redis and Django combination is awesome if your Api's are slow and not responding or your server is showing 502 error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Post Link:- https://pythondjangogeek.com/django/how-to-use-redis-in-django-to-optimize-your-django/
Linkedin:- https://www.linkedin.com/in/shivamrohillaa/
Github Link:- https://github.com/ShivamRohilllaa/django-redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  So, let's talk about Redis
&lt;/h2&gt;

&lt;p&gt;Redis is fast and basically it's a storage system, which stores your data and set all the data in cache.&lt;br&gt;
and then you can retrieve your data through the cache.&lt;/p&gt;
&lt;h2&gt;
  
  
  How Redis Boosts Django Performance
&lt;/h2&gt;

&lt;p&gt;we use Redis with Django, when our api's are slows down due to multiple database queries. then we use caching to store the data and access the data frequently, when your data is set in redis, you just have to call the cache function(I'll explain in code below), and that cache function returns the data without hit the database, it's a one time process, it hits the database while set the cache or when we store the data in cache. and that's how redis speed up the api's or django queries, and it reduce the database load, and it's fast.&lt;/p&gt;
&lt;h2&gt;
  
  
  Using Redis with Django: A Step-by-Step Guide
&lt;/h2&gt;

&lt;p&gt;So, now we'll learn how to use redis with django for optimization.&lt;br&gt;
We'll test redis with 10k+ objects.&lt;/p&gt;

&lt;p&gt;So, first of all download Redis:-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Download Redis
Redis for 64-bit Windows from this GitHub page: https://github.com/MicrosoftArchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.msi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and after installing this, Go to your installed directory and run the redis-cli&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xQasINRL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5puejtjgdta8gk8jq377.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xQasINRL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5puejtjgdta8gk8jq377.png" alt="Image description" width="785" height="54"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9wgPoPjX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5mx7r31qs2m3an742wvc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9wgPoPjX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5mx7r31qs2m3an742wvc.png" alt="Image description" width="800" height="511"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and now we start our django project, I hope you guys know how to create a django project and django app.&lt;/p&gt;

&lt;p&gt;Now, add redis configuration in django settings.py&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
CACHES = {
    'default': {
        'BACKEND': 'django_redis.cache.RedisCache',
        'LOCATION': 'redis://127.0.0.1:6379/1',  # Replace with your Redis server details
        'OPTIONS': {
            'CLIENT_CLASS': 'django_redis.client.DefaultClient',
        }
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;now create a model in models.py file,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Post(models.Model):
    title = models.CharField(max_length=250)
    description = models.TextField()

    def __str__(self):
        return self.title
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and add some objects and run script for adding duplicate data in the model, now we write main logic for the redis for set the cache and get the cache,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.shortcuts import render
from post.models import Post
from django.core.cache import cache
from django.http import HttpResponse

# Create your views here.

def home(request):
    qs = Post.objects.all()
    context = {'qs':qs}
    return render(request, 'index.html', context)

def set_data_in_cache(request):
    # Retrieve the data you want to cache
    qs = Post.objects.all()

    # Set the data in the Redis cache
    cache.set('post_data_key', qs)

    return HttpResponse("Data has been set in the cache.")

def get_data_from_cache(request):
    # Get the data from the Redis cache
    cached_data = cache.get('post_data_key')
    print(cached_data, 'cached_data')

    if cached_data is not None:
        # If data is found in the cache, you can use it as needed
        return render(request, 'redis_data.html', {'qs': cached_data})
    else:
        # If data is not found in the cache, you may choose to retrieve it from the database
        qs = Post.objects.all()
        return render(request, 'index.html', {'qs': qs})

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we use two function for set and get the cache in redis, and that's so simple and easy,&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
for set the cache we use:- cache.set('post_data_key')&lt;br&gt;
for get the cache we use:- cache.get('post_data_key')&lt;br&gt;
&lt;/code&gt;`&lt;/p&gt;

&lt;p&gt;and we set the Post model data in redis cache key and then we fetch the data from the cache key which you set in redis, and there's one more thing and that is timeout, if you want to expire your cache key so you can add the timeout while setting the cache key, you can use timeout=20 or any number, and if you don't want to expire your key, then use timeout=None, so that's how we can optimize our django app with the use of Redis.&lt;/p&gt;

&lt;p&gt;Thank You&lt;br&gt;
Shivam Rohilla | Python Developer&lt;/p&gt;

</description>
      <category>python</category>
      <category>django</category>
      <category>redis</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to create a CRUD API in Django Rest Framework with APIView, ViewSets, and Swagger Documentation</title>
      <dc:creator>Shivam Rohilla</dc:creator>
      <pubDate>Sun, 06 Aug 2023 18:04:45 +0000</pubDate>
      <link>https://dev.to/shivamrohilla/building-a-crud-api-in-django-rest-framework-with-apiview-viewsets-and-swagger-documentation-3013</link>
      <guid>https://dev.to/shivamrohilla/building-a-crud-api-in-django-rest-framework-with-apiview-viewsets-and-swagger-documentation-3013</guid>
      <description>&lt;p&gt;Are you looking to develop a robust CRUD (Create, Read, Update, Delete) API in Django Rest Framework? In this blog post, we'll guide you through the process of building a CRUD API using both APIView and ViewSets, and we'll enhance it with Swagger documentation for easy API exploration and testing.&lt;/p&gt;

&lt;p&gt;Django Rest Framework (DRF) is a powerful toolkit for building Web APIs in Django. It provides a flexible and easy-to-use framework for creating RESTful APIs with features like authentication, serialization, and request/response handling. We'll utilize two different approaches offered by DRF to build our CRUD API.&lt;/p&gt;

&lt;p&gt;APIViews:&lt;/p&gt;

&lt;p&gt;APIViews in DRF allow us to define the API logic as class-based views. We'll create an APIView-based class that handles the different HTTP methods (GET, POST, PUT, DELETE) to perform the respective CRUD operations. With the help of the swagger_auto_schema decorator, we'll also add detailed Swagger annotations for request and response descriptions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from rest_framework import status
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.views import APIView
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from .models import MyModel
from .serializers import MyModelSerializer

class MyModelAPIView(APIView):
    @swagger_auto_schema(
        operation_description="Get all models",
        responses={200: MyModelSerializer(many=True)}
    )
    def get(self, request):
        queryset = MyModel.objects.all()
        serializer = MyModelSerializer(queryset, many=True)
        return Response(serializer.data)

    @swagger_auto_schema(
        operation_description="Create a new model",
        request_body=MyModelSerializer,
        responses={201: MyModelSerializer()}
    )
    def post(self, request):
        serializer = MyModelSerializer(data=request.data)
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data, status=status.HTTP_201_CREATED)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

    @swagger_auto_schema(
        operation_description="Update a model",
        request_body=MyModelSerializer,
        responses={200: MyModelSerializer()}
    )
    def put(self, request, pk):
        try:
            instance = MyModel.objects.get(pk=pk)
        except MyModel.DoesNotExist:
            return Response(status=status.HTTP_404_NOT_FOUND)

        serializer = MyModelSerializer(instance, data=request.data)
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

    @swagger_auto_schema(
        operation_description="Delete a model"
    )
    def delete(self, request, pk):
        try:
            instance = MyModel.objects.get(pk=pk)
        except MyModel.DoesNotExist:
            return Response(status=status.HTTP_404_NOT_FOUND)

        instance.delete()
        return Response(status=status.HTTP_204_NO_CONTENT)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ViewSets:&lt;/p&gt;

&lt;p&gt;ViewSets in DRF provide a higher-level abstraction for building APIs. We'll create a ViewSet-based class that encapsulates the logic for handling different actions like list, create, retrieve, update, and delete. By registering the ViewSet with a router, we'll automatically generate the URL patterns for our API. Similar to the APIView approach, we'll use the swagger_auto_schema decorator to add Swagger annotations for clear API documentation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from rest_framework import status
from rest_framework.response import Response
from rest_framework.viewsets import ViewSet
from rest_framework.decorators import action
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from .models import MyModel
from .serializers import MyModelSerializer

class MyModelViewSet(ViewSet):
    @swagger_auto_schema(
        operation_description="Get all models",
        responses={200: MyModelSerializer(many=True)}
    )
    def list(self, request):
        queryset = MyModel.objects.all()
        serializer = MyModelSerializer(queryset, many=True)
        return Response(serializer.data)

    @swagger_auto_schema(
        operation_description="Create a new model",
        request_body=MyModelSerializer,
        responses={201: MyModelSerializer()}
    )
    def create(self, request):
        serializer = MyModelSerializer(data=request.data)
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data, status=status.HTTP_201_CREATED)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

    @swagger_auto_schema(
        operation_description="Get a model by ID",
        responses={200: MyModelSerializer()}
    )
    def retrieve(self, request, pk=None):
        try:
            instance = MyModel.objects.get(pk=pk)
        except MyModel.DoesNotExist:
            return Response(status=status.HTTP_404_NOT_FOUND)

        serializer = MyModelSerializer(instance)
        return Response(serializer.data)

    @swagger_auto_schema(
        operation_description="Update a model",
        request_body=MyModelSerializer,
        responses={200: MyModelSerializer()}
    )
    def update(self, request, pk=None):
        try:
            instance = MyModel.objects.get(pk=pk)
        except MyModel.DoesNotExist:
            return Response(status=status.HTTP_404_NOT_FOUND)

        serializer = MyModelSerializer(instance, data=request.data)
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

    @swagger_auto_schema(
        operation_description="Delete a model"
    )
    def destroy(self, request, pk=None):
        try:
            instance = MyModel.objects.get(pk=pk)
        except MyModel.DoesNotExist:
            return Response(status=status.HTTP_404_NOT_FOUND)

        instance.delete()
        return Response(status=status.HTTP_204_NO_CONTENT)

    @swagger_auto_schema(
        operation_description="Custom action",
        responses={200: "Custom action executed"}
    )
    @action(detail=True, methods=['post'])
    def custom_action(self, request, pk=None):
        try:
            instance = MyModel.objects.get(pk=pk)
        except MyModel.DoesNotExist:
            return Response(status=status.HTTP_404_NOT_FOUND)

        # Perform custom action here

        return Response("Custom action executed", status=status.HTTP_200_OK)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Swagger Documentation:&lt;/p&gt;

&lt;p&gt;Swagger is an open-source toolset for designing, building, documenting, and consuming RESTful APIs. By incorporating Swagger into our DRF project, we can generate interactive API documentation that allows developers to explore and test the API endpoints effortlessly. We'll use the drf-yasg package, which integrates Swagger with DRF, to automatically generate the API documentation based on the Swagger annotations we added.&lt;/p&gt;

&lt;p&gt;To install drf-yasg, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install drf-yasg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once installed, you can configure Swagger in your project's urls.py file as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.urls import path, include
from rest_framework import routers
from .views import MyModelViewSet, MyModelAPIView
from drf_yasg.views import get_schema_view
from drf_yasg import openapi

router = routers.DefaultRouter()
router.register(r'models', MyModelViewSet)

schema_view = get_schema_view(
    openapi.Info(
        title="Your API",
        default_version='v1',
        description="API documentation powered by Swagger",
        terms_of_service="https://your-terms-of-service-url.com/",
        contact=openapi.Contact(email="contact@your-api.com"),
        license=openapi.License(name="Your API License"),
    ),
    public=True,
)

urlpatterns = [
    path('', include(router.urls)),
    path('api-docs/', schema_view.with_ui('swagger', cache_timeout=0), name='api-docs'),
    # Other paths in your URL configuration
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this tutorial, we've covered the basics of building a CRUD API using both APIView and ViewSets in Django Rest Framework. We've also learned how to enhance the API documentation using Swagger and the drf-yasg package. By following this guide, you can create a powerful and well-documented API that adheres to RESTful principles and provides a seamless experience for developers consuming your API.&lt;/p&gt;

&lt;p&gt;Stay tuned for more Django Rest Framework tutorials and explore the limitless possibilities of building robust and scalable APIs with Django!&lt;/p&gt;

&lt;p&gt;Shivam Rohilla | Python Developer&lt;br&gt;
Thank You&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
      <category>djangorestframework</category>
      <category>swagger</category>
    </item>
    <item>
      <title>How to Send Emails in Django: A Step-by-Step Guide</title>
      <dc:creator>Shivam Rohilla</dc:creator>
      <pubDate>Fri, 20 Jan 2023 18:33:40 +0000</pubDate>
      <link>https://dev.to/shivamrohilla/how-to-send-an-email-in-django-4pdd</link>
      <guid>https://dev.to/shivamrohilla/how-to-send-an-email-in-django-4pdd</guid>
      <description>&lt;p&gt;Django is a popular web framework for building web applications in Python. One of the common tasks when building web applications is sending emails. In this blog post, we will learn how to send emails in Django.&lt;/p&gt;

&lt;p&gt;First, we need to configure the email settings in the settings.py file. We can use the built-in EmailBackend or use an external service like Gmail or Amazon SES. Here's an example of how to configure the email settings using the built-in EmailBackend:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'your_email@gmail.com'
EMAIL_HOST_PASSWORD = 'your_password'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the email settings are configured, we can use the built-in send_mail function to send emails. Here's an example of how to use the send_mail function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.core.mail import send_mail

send_mail(
    'Subject',
    'Here is the message.',
    'from@example.com',
    ['to@example.com'],
    fail_silently=False,
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The send_mail function takes five arguments:&lt;/p&gt;

&lt;p&gt;Subject: The subject of the email.&lt;br&gt;
Message: The message of the email.&lt;br&gt;
From email: The email address of the sender.&lt;br&gt;
List of recipient emails: A list of email addresses of the recipients.&lt;br&gt;
fail_silently: A boolean value that indicates whether to raise an exception if the email fails to send.&lt;br&gt;
You can also use the EmailMessage class to create more advanced emails with multiple recipients, cc, bcc, attachments and headers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.core.mail import EmailMessage

email = EmailMessage(
    'Hello',
    'Body goes here',
    'from@example.com',
    ['first@example.com', 'second@example.com'],
    ['bcc@example.com'],
    reply_to=['another@example.com'],
    headers={'Message-ID': 'foo'},
)

email.send()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! With these simple steps, you can send emails in Django. You can also use other libraries like Celery to handle sending emails asynchronously.&lt;/p&gt;

&lt;p&gt;Thank You&lt;br&gt;
Shivam Rohilla | Python Developer&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>django</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Create a CRUD API in four steps using DjangoRestFramework.</title>
      <dc:creator>Shivam Rohilla</dc:creator>
      <pubDate>Tue, 03 Jan 2023 20:43:02 +0000</pubDate>
      <link>https://dev.to/shivamrohilla/create-a-crud-api-in-four-steps-using-djangorestframework-2k1o</link>
      <guid>https://dev.to/shivamrohilla/create-a-crud-api-in-four-steps-using-djangorestframework-2k1o</guid>
      <description>&lt;p&gt;DjangoRestFramework (DRF) is a powerful toolkit for building APIs in the Django web framework. It provides a set of tools and libraries for building APIs, including serialization, validation, authentication, and more. DRF is designed to make it easy for developers to create APIs that can be consumed by a variety of clients, including web and mobile applications. With DRF, developers can build APIs that support CRUD (create, read, update, delete) operations, as well as custom endpoints for specific functionality. Overall, DRF is a popular choice for building APIs in Django due to its flexibility and ease of use.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Post link:- 

https://pythondjangogeek.com/django/create-a-crud-api-in-four-steps-using-djangorestfr/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CRUD API, or Create, Read, Update, and Delete API, allows developers to create an API that performs basic database operations. In this blog, we will go through the steps of creating a CRUD API using DjangoRestFramework in four simple steps.&lt;/p&gt;

&lt;p&gt;Setup Django and Django Rest Framework:&lt;/p&gt;

&lt;p&gt;First, make sure you have Django and Django Rest Framework installed on your machine. If you don't have them installed, you can install them using pip:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install django
pip install djangorestframework
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you have them installed, create a new Django project and app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;django-admin startproject myproject
cd myproject
python manage.py startapp myapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a Model:&lt;br&gt;
In this step, we will create a model that represents the object that we want to store in our API. For example, let's say we want to store a list of tasks. We can create a Task model with the following fields:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.db import models

class Task(models.Model):
    title = models.CharField(max_length=200)
    description = models.TextField()
    completed = models.BooleanField(default=False)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a Serializer and a View:&lt;/p&gt;

&lt;p&gt;Next, we need to create a serializer and a view to handle the incoming HTTP requests. A serializer is used to convert the data in our model into a JSON format that can be sent over the internet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from rest_framework import serializers
from .models import Task

class TaskSerializer(serializers.ModelSerializer):
    class Meta:
        model = Task
        fields = ('id', 'title', 'description', 'completed')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The view will handle the incoming HTTP requests and return a response. We can create a view using Django Rest Framework's generic views:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from rest_framework import generics
from .models import Task
from .serializers import TaskSerializer

class TaskList(generics.ListCreateAPIView):
    queryset = Task.objects.all()
    serializer_class = TaskSerializer

class TaskDetail(generics.RetrieveUpdateDestroyAPIView):
    queryset = Task.objects.all()
    serializer_class = TaskSerializer

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a URL pattern:&lt;br&gt;
Finally, we need to create a URL pattern that maps the incoming HTTP requests to our view. Add the following to your urls.py file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.urls import path
from . import views

urlpatterns = [
    path('tasks/', views.TaskList.as_view(), name='task_list'),
    path('tasks/&amp;lt;int:pk&amp;gt;/', views.TaskDetail.as_view(), name='task_detail'),
]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! With these four steps, you have created a CRUD API using Django Rest Framework. You can test your API using a tool &lt;br&gt;
like Postman or by making HTTP requests using Python's requests library.&lt;/p&gt;

&lt;p&gt;Shivam Rohilla | Python Developer&lt;br&gt;
Thank You&lt;/p&gt;

</description>
      <category>python</category>
      <category>django</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to work with Django forms.</title>
      <dc:creator>Shivam Rohilla</dc:creator>
      <pubDate>Sat, 28 May 2022 12:48:43 +0000</pubDate>
      <link>https://dev.to/shivamrohilla/how-to-work-with-django-forms-48n4</link>
      <guid>https://dev.to/shivamrohilla/how-to-work-with-django-forms-48n4</guid>
      <description>&lt;p&gt;Hello guys, today we'll learn how to work with django forms, as we know that we use django forms to save data in the models, django forms generate the HTML Forms to save the data, django provides the Form class that is used to generate html form.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Source code:- https://github.com/ShivamRohilllaa/django-form
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, now we are creating a django form, in forms.py&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django import forms

class TaskForm(forms.Form):
    Title = forms.CharField(max_length = 200)
    description = forms.TextField(max_length = 500)   

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;now write a view for saving the data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.shortcuts import render, redirect
from .forms import TaskForm
from .models import Task
# Create your views here.

def index(request):
    tform = TaskForm()
    if request.method == 'POST':
        form = TaskForm(request.POST)
        if form.is_valid():
            title = form.cleaned_data['title']
            description = form.cleaned_data['description']
            data = Task.objects.create(title=title, description=description)     
    context = {'form':tform}              
    return render(request, 'index.html', context)


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then render this form in index.html&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    &amp;lt;form method='POST'&amp;gt;
    {% csrf_token %}    
    {{form}}
    &amp;lt;button class="btn" type="submit" value="submit"&amp;gt; Save &amp;lt;/button&amp;gt;
    &amp;lt;/form&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See the output below and fill the data in form and then press save button after that check the django admin if data is saved or not.&lt;/p&gt;

&lt;h1&gt;
  
  
  Output
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fszldk9scfogzdtd1nfgk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fszldk9scfogzdtd1nfgk.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9jh8u701j0mg1f3yobbk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9jh8u701j0mg1f3yobbk.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;For More and contact:- https://webdevcodes.com/django/how-to-work-with-django-forms/ 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank You&lt;br&gt;
Shivam Rohilla | Python Developer&lt;/p&gt;

</description>
      <category>python</category>
      <category>django</category>
      <category>javascript</category>
      <category>developer</category>
    </item>
    <item>
      <title>User Authentication in DjangoRestFramework using SimpleJWT [Login, Signup]</title>
      <dc:creator>Shivam Rohilla</dc:creator>
      <pubDate>Tue, 22 Mar 2022 09:24:05 +0000</pubDate>
      <link>https://dev.to/shivamrohilla/user-authentication-in-djangorestframework-using-simplejwt-login-signup-3kd8</link>
      <guid>https://dev.to/shivamrohilla/user-authentication-in-djangorestframework-using-simplejwt-login-signup-3kd8</guid>
      <description>&lt;p&gt;Hello Devs, In this blog you will learn how to create User Authentication, login and signup API's in djangorestframework using SimpleJWT.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Source Code:- https://github.com/ShivamRohilllaa/DjangoRestFramework-UserAuthentication/

Post Link:- https://pythondjangogeek.com/django/streamlined-user-authentication-with-django-and-si/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope you guys knows how to create a django project so I am skipping those steps and let's jump on code directly. &lt;/p&gt;

&lt;p&gt;Create virtual enviornment,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 -m venv envname
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install these packages:-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;django
djangorestframework
djangorestframework-simplejwt

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add restframework in your installed apps in settings.py file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSTALLED_APPS = [
    'rest_framework',
]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and add these settings for rest_framework and simpleJWT.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework_simplejwt.authentication.JWTAuthentication',
    )
}    

SIMPLE_JWT = {
    'ACCESS_TOKEN_LIFETIME': timedelta(days=15),
    'AUTH_HEADER_TYPES': ('Bearer',),
    'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken',),
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create Model for a student
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Student(models.Model):
    auth = models.OneToOneField(User, on_delete=models.CASCADE, related_name='student_profile')
    name = models.CharField(max_length=100)
    email = models.EmailField(max_length=100)

    def __str__(self):
        return self.name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and now we will create user signup and user profile serializers for signup and login&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from rest_framework import serializers
from userapp.models import Student
from django.contrib.auth.models import User

class UserSignupSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = ('first_name', 'last_name', 'email', 'password')

    extra_kwargs = {
        'first_name': {'required': True, 'allow_blank': False},
        'last_name': {'required': True, 'allow_blank': False},
        'email': {'required': True, 'allow_blank': False},
        'password': {'required': True, 'allow_blank': False},        
    }    


class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = ('id', 'first_name', 'last_name', 'email', 'username')

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;now write views for utilise the serializers&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.shortcuts import render
from .models import Student
from .serializers import UserSignupSerializer, UserSerializer
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework import status

from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import User

@api_view(['POST'])
def signup(request):
    data = request.data
    serializer = UserSignupSerializer(data=data)
    if serializer.is_valid():
        if not User.objects.filter(username=data['email']).exists():
            user = User.objects.create(first_name=data['first_name'], last_name=data['last_name'], username=data['email'], email=data['email'], password=make_password(data['password']))
            user.save()
            student = Student.objects.create(auth=user, name=data['first_name'], email=data['email'])
            return Response({'message':'User Created Successfully'}, status=status.HTTP_201_CREATED)
        else:
            return Response({'message':'User Already Exists'}, status=status.HTTP_400_BAD_REQUEST)
    else:
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

@api_view(['GET'])
def login(request):
    data = request.data
    if User.objects.filter(username=data['email']).exists():
        user = User.objects.get(username=data['email'])
        if user.check_password(data['password']):
            return Response(UserSerializer(instance=user).data, status=status.HTTP_200_OK)
        else:
            return Response({'message':'Invalid Password'}, status=status.HTTP_400_BAD_REQUEST)
    else:
        return Response({'message':'User Does Not Exist'}, status=status.HTTP_400_BAD_REQUEST)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Now map these views in urls.py
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;urlpatterns = [
    path('signup/', views.signup, name='signup'),
    path('login/', views.login, name='login'),
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and for testing these endpoints use postman and pass these responses&lt;/p&gt;

&lt;h4&gt;
  
  
  for singup api
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
"first_name": "demo",
"last_name": "demo",
"email": "demo@gmail.com",
"password": "demo"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  for login
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
"email": "demo@gmail.com",
"password": "demo"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Source Code
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Source Code:- https://github.com/ShivamRohilllaa/DjangoRestFramework-UserAuthentication/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank You&lt;br&gt;
Shivam Rohilla | Python Developer&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DM me your queries:-
https://www.linkedin.com/in/shivamrohillaa/ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>django</category>
      <category>python</category>
    </item>
    <item>
      <title>How to make a Rock Paper Scissors game in Django</title>
      <dc:creator>Shivam Rohilla</dc:creator>
      <pubDate>Fri, 14 Jan 2022 18:02:12 +0000</pubDate>
      <link>https://dev.to/shivamrohilla/how-to-make-a-rock-paper-scissors-game-in-django-2p1c</link>
      <guid>https://dev.to/shivamrohilla/how-to-make-a-rock-paper-scissors-game-in-django-2p1c</guid>
      <description>&lt;p&gt;Hello Devs,&lt;br&gt;
In this Post I'm gonna show you how to make a rock paper scissors game in Django using Python logic.&lt;/p&gt;

&lt;p&gt;Original Post / For More:-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://www.webdevcodes.com/python/how-to-make-a-rock-paper-scissors-game-in-django/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's a Github Repo and Source Code, Live demo&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://github.com/ShivamRohilllaa/rock-paper-scissors
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Live demo&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://stonepsgame.herokuapp.com/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope you know how to create a django project directory and base and how to create apps, so I'm going to point straightly.&lt;/p&gt;

&lt;h4&gt;
  
  
  So, we are gonna create following things in the project
&lt;/h4&gt;

&lt;p&gt;1) Start Game / Create User&lt;br&gt;
2) Game Page&lt;br&gt;
3) Messages &lt;br&gt;
4) Result / Store user result&lt;br&gt;
5) End Game&lt;/p&gt;

&lt;p&gt;So, now let's create models in models.py&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.contrib.auth.models import User

class Player(models.Model):
    '''
    Player model 
    '''
    name = models.CharField(max_length=50)
    user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='player')

    def __str__(self):
        return self.name


class Result(models.Model):
    '''
    Result model in which all players result will be stored
    '''
    player = models.ForeignKey("Player", on_delete=models.CASCADE, related_name='score')
    bot_move = models.CharField(max_length=50, blank=True)
    user_move = models.CharField(max_length=50, blank=True)
    status = models.CharField(max_length=50, blank=True)

    def __str__(self):
        return 'Status -- ' + self.status + ' ' + self.player.name

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Run these commands
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
python manage.py makemigrations
python manage.py migrate

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we will create user on home page and take input from user and stored in our database.&lt;/p&gt;

&lt;p&gt;So let's create views&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
def home(request):
    '''
    homepage and start game logic
    '''
    if request.method=='POST':
        playername = request.POST.get('name')
        if User.objects.filter(username__iexact=playername):
            messages.warning(request, 'This name is already exists, please try another one.')
            return HttpResponseRedirect(request.path_info)
        create_user = User.objects.create(first_name=playername, username=playername)
        create_player = Player.objects.create(name=playername, user=create_user)
        return redirect('start_game')

    return render(request, 'index.html')

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above code, we store username from form and will create user objects from form input and if someone is already entered a username so it will show error message.&lt;/p&gt;

&lt;p&gt;and here's a Python simple logic for game and learn how to implement python logic in django.&lt;br&gt;
we make a list and store rock paper and scissors move in list and then make a bot using python random library so we can play against a bot. and when we play a move we will see a message and that message is implemented using django messages framework.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def game(request):
    '''
    Rock, paper and scissor logic
    '''
    gamelist = ['rock', 'paper', 'scissors']
    bot_action = random.choice(gamelist)
    user = Player.objects.all().last()

    if request.method == 'POST':
        user_answer = request.POST.get('name')

        if user_answer == bot_action:
            messages.info(request, f"Both players selected. It's a tie!")
            result = Result.objects.create(player=user, bot_move=bot_action, user_move=user_answer, status='Tie')
            log.debug("Both players selected. It's a tie!")

        elif user_answer == "rock":
            if bot_action == "scissors":
                messages.success(request, "Rock smashes scissors! You win!")
                result = Result.objects.create(player=user, bot_move=bot_action, user_move=user_answer, status='Win')
                log.debug(f"Rock smashes scissors! You win! - Actions: Bot - {bot_action} User - {user_answer}")
            else:
                result = Result.objects.create(player=user, bot_move=bot_action, user_move=user_answer, status='Lose')
                messages.info(request, "Paper covers rock! You lose.")
                log.debug(f"Paper covers rock! You lose. Actions: Bot - {bot_action} User - {user_answer}" )

        elif user_answer == "paper":
            if bot_action == "rock":
                messages.success(request, "Paper covers rock! You win!")
                result = Result.objects.create(player=user, bot_move=bot_action, user_move=user_answer, status='Win')
                log.debug(f"Paper covers rock! You win! Actions: Bot - {bot_action} User - {user_answer}")
            else:
                result = Result.objects.create(player=user, bot_move=bot_action, user_move=user_answer, status='Lose')
                messages.info(request, "Scissors cuts paper! You lose.")
                log.debug(f"Scissors cuts paper! You lose. Actions: Bot - {bot_action} User - {user_answer}")

        elif user_answer == "scissors":
            if bot_action == "paper":
                result = Result.objects.create(player=user, bot_move=bot_action, user_move=user_answer, status='Win')
                messages.success(request, "Scissors cuts paper! You win!")
                log.debug(f"Scissors cuts paper! You win! Actions: Bot - {bot_action} User - {user_answer}")
            else:
                result = Result.objects.create(player=user, bot_move=bot_action, user_move=user_answer, status='Lose')
                messages.info(request, "Rock smashes scissors! You lose.")
                log.debug(f"Rock smashes scissors! You lose. Actions: Bot - {bot_action} User - {user_answer}")

    return render(request, 'game.html', {'user':user})

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  here's a result page in which you can see your result for every move.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def result(request):
    '''
    All users results
    '''
    res = Result.objects.all().order_by('-id')
    context = {'res':res}
    return render(request, 'result.html', context)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now define views urls path in urls.py&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;urlpatterns = [
    path('', views.home, name='home'),
    path('start-game/', views.game, name='start_game'),
    path('result/', views.result, name='result'),
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's a Github Repo and Source Code, Live demo&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://github.com/ShivamRohilllaa/rock-paper-scissors
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Live demo&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://stonepsgame.herokuapp.com/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Here's images of Project
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy5ntqhzchkgcaonp5byk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy5ntqhzchkgcaonp5byk.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffpu0jjhmbx6kafiduaz5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffpu0jjhmbx6kafiduaz5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwv74ldkvg20aevbccxov.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwv74ldkvg20aevbccxov.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxxip1o4fa6a79s8iwdk8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxxip1o4fa6a79s8iwdk8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>gamedev</category>
      <category>django</category>
      <category>programming</category>
    </item>
    <item>
      <title>Django Formset: Submit two django forms at once.</title>
      <dc:creator>Shivam Rohilla</dc:creator>
      <pubDate>Sat, 25 Dec 2021 10:51:35 +0000</pubDate>
      <link>https://dev.to/shivamrohilla/django-formset-submit-two-django-forms-at-once-182a</link>
      <guid>https://dev.to/shivamrohilla/django-formset-submit-two-django-forms-at-once-182a</guid>
      <description>&lt;p&gt;Hello Devs, In this Post I'm gonna show you how can we submit two django forms at once and this is also called django inline forms, for example I have two forms one is for Question and another one is for Answers, and I want a inline form, like one question and that question have four answers, ok so let's see how can we do that.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsyrp0yonmd68gnvuv10l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsyrp0yonmd68gnvuv10l.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Source Code:- 
https://github.com/ShivamRohilllaa/django-formset
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Original Post:- https://www.webdevcodes.com/django/django-formset-submit-two-django-forms-at-once/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First of all create two tables in models.py:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Question(models.Model):
    text = models.CharField(max_length=200, unique=True)
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return str(self.text)

    #Reverse relationship
    def get_answers(self):
        return self.answers.all()   

class Answer(models.Model):
    text = models.CharField(max_length=200, verbose_name='Answer')
    correct = models.BooleanField()
    question = models.ForeignKey(Question, on_delete=models.CASCADE, related_name='answers')
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return f"question {self.question.text}, answer: {self.text}. correct: {self.correct}"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now create modelforms in forms.py:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.forms.models import modelformset_factory


class QuestionsForm(forms.ModelForm):
    text = forms.CharField(label='Question', required=True)

    class Meta:
        model = Question
        fields = ['text']


AnswerFormset = modelformset_factory(
    Answer,
    fields=('text', 'correct'),
    extra=4,
    widgets={ 'text': forms.TextInput(attrs={ 'class': 'form-control','placeholder': 'Enter Answer here'}
            )
        }
)        


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;import modelformset_factory then use modelformset_factory this in that form in which you want to show extra fields. for example one question have multiple answers, so we modelformset_factory in answer form&lt;/p&gt;

&lt;p&gt;Now create views for that forms.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
def add_questions(request):
    ques= QuestionsForm()
    formset = AnswerFormset(queryset=Answer.objects.none())
    if request.method=='POST':
        ques= QuestionsForm(request.POST)
        formset = AnswerFormset(request.POST)
        if ques.is_valid() and formset.is_valid():
            ques = ques.save()
            for form in formset:
                answer = form.save(commit=False)
                answer.question = ques
                answer.save() 
            return redirect('home')
    return render(request, "add-ques.html", {'ques':ques, 'formset':formset})


def home(request):
    ques = Question.objects.all()
    context = {'ques':ques}
    return render(request, 'index.html', context)


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now render that form in your template&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form action="." method='post'&amp;gt;
        {% csrf_token %}
        {% for field in ques %}
        &amp;lt;div class="form-group"&amp;gt;
            &amp;lt;label for="text"&amp;gt;{{field.label}}:&amp;lt;/label&amp;gt;
            {{field}}
        &amp;lt;/div&amp;gt;
        {% endfor %}
        {% comment %} {{ques}}
        {{formset}} {% endcomment %}
        {{ formset.management_form }}
        {% for field in formset %}
        &amp;lt;div class="form-group mt-5 mb-5"&amp;gt;
          &amp;lt;label for="text"&amp;gt;{{field.label}}&amp;lt;/label&amp;gt;
          {{field.text}}
        &amp;lt;/div&amp;gt;
        {% endfor %}
        &amp;lt;button type="submit" class="btn btn-primary"&amp;gt;Submit&amp;lt;/button&amp;gt;
      &amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;that's it and this is how your form look like&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fynq1poa13lr71xftruh5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fynq1poa13lr71xftruh5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbepokev6xjgghjnyy3z8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbepokev6xjgghjnyy3z8.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Source Code:- 
https://github.com/ShivamRohilllaa/django-formset
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank you&lt;br&gt;
Shivam Rohilla Python Developer&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
      <category>programming</category>
      <category>career</category>
    </item>
    <item>
      <title>What is FastAPI ? Why it's so demanding.</title>
      <dc:creator>Shivam Rohilla</dc:creator>
      <pubDate>Wed, 11 Aug 2021 20:09:11 +0000</pubDate>
      <link>https://dev.to/shivamrohilla/what-is-fastapi-why-it-s-so-demanding-2iii</link>
      <guid>https://dev.to/shivamrohilla/what-is-fastapi-why-it-s-so-demanding-2iii</guid>
      <description>&lt;p&gt;Hello guys, In this Article I'll tell you something about the python new web API framework - FastAPi Framework.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is FastAPI ?
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0x0p2bkh6q2mquth89vk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0x0p2bkh6q2mquth89vk.png" alt="logo-teal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;FastAPI is a new python web framework, FastAPI is modern and very fast, high-performance. FastAPI is used for building web applications and API's with Python and FastAPI was released in 2018 and FastAPI mainly used for making the data science applications as well as ecommerce. FastAPI enables the developers to use REST API interface and use many functions to implement them into applications, developers uses FastAPI to create login/Signup, authenticate and create accounts etc.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why it's so demanding.
&lt;/h1&gt;

&lt;p&gt;FastAPI has a great future guys, companies uses this because it's very fast and highly securable and it has many feature like security and authentication, Dependency Injection, Unlimited plugins and etc, many big giants tech companies already using this framework for their data science applications and web applications, there are many companies like Microsoft and Netflix, Uber etc. Even my company use this framework, It's only 3 years old framework and it's already in trend, maybe this framework create thousands of jobs in future.&lt;/p&gt;

&lt;h4&gt;
  
  
  FastAPI documentation
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://fastapi.tiangolo.com/" rel="noopener noreferrer"&gt;https://fastapi.tiangolo.com/&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Youtube Channels and Playlists for fastAPI
&lt;/h4&gt;

&lt;p&gt;1) Bitfumes &lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=7t2alSnE2-I" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=7t2alSnE2-I&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) IsaiahT Tech&lt;br&gt;
Complete Playlist &lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=tKL6wEqbyNs&amp;amp;list=PLShTCj6cbon9gK9AbDSxZbas1F6b6C_Mx" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=tKL6wEqbyNs&amp;amp;list=PLShTCj6cbon9gK9AbDSxZbas1F6b6C_Mx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3) Very Academy&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=NH4VZaP3_9s&amp;amp;t=242s" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=NH4VZaP3_9s&amp;amp;t=242s&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for more visit:- https://webdevcodes.com/python/what-is-fastapi-why-its-so-demanding/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find me on Linkedin&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://www.linkedin.com/in/shivamrohillaa/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank You&lt;br&gt;
Shivam Rohilla | Python Developer&lt;/p&gt;

</description>
      <category>python</category>
      <category>career</category>
      <category>computerscience</category>
      <category>django</category>
    </item>
    <item>
      <title>Most demanding backend framework in Software industry.</title>
      <dc:creator>Shivam Rohilla</dc:creator>
      <pubDate>Sat, 07 Aug 2021 17:58:53 +0000</pubDate>
      <link>https://dev.to/shivamrohilla/most-demanding-backend-framework-in-software-industry-3ao4</link>
      <guid>https://dev.to/shivamrohilla/most-demanding-backend-framework-in-software-industry-3ao4</guid>
      <description>&lt;p&gt;Hello Devs, In this blog, I'll tell you something about the most trending and demanding backend framework in the software industry and obviously it's highly paid.&lt;br&gt;
and that backend framework is Django Python Web Framework, yes Django is the most demanding and highly paid backend framework in the software industry and Django is used widely in Web Development and Django is the most lovable Backend framework. Django is the best framework.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is Python ?
&lt;/h2&gt;

&lt;p&gt;As we know Python is the best programming language in 2021, Python ranks in Top 3 programming language according to TIOBE INDEX, Python is a high-level programming language, many big companies and tech giants use Python as their primary language and they uses Python framework as the primary framework because of their scalability, and that companies are Google, Instagram, Spotify, Quora, and Dropbox, Facebook.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is Django ?
&lt;/h2&gt;

&lt;p&gt;Django is a high-level Python Web Framework, it follows MVT(Model, View, Template) architecture and it's highly scalable and secure, enables rapid development and great community, yeah but it's cost effective, I never suggest Django for smaller projects.&lt;/p&gt;
&lt;h5&gt;
  
  
  Here are the Top Companies who uses Django.
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt;Disqus&lt;/li&gt;
&lt;li&gt;YouTube&lt;/li&gt;
&lt;li&gt;Instagram&lt;/li&gt;
&lt;li&gt;Spotify&lt;/li&gt;
&lt;li&gt;Bitbucket&lt;/li&gt;
&lt;li&gt;DropBox&lt;/li&gt;
&lt;li&gt;Mozilla&lt;/li&gt;
&lt;li&gt;Pinterest&lt;/li&gt;
&lt;li&gt;The Washington Post&lt;/li&gt;
&lt;li&gt;Eventbrite&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can create many types of application in Django like Ecommerce, Social Network, Chat Applications, Food delivery projects, blogging applications etc.&lt;br&gt;
It enables the rapid development and you can create a simple ecommerce website in just 3-4 hours, it's very fast, but Django is cost effective, it's hosting is very expensive and Most probably Django is used in highly scalable application like Youtube or Instagram.&lt;/p&gt;
&lt;h1&gt;
  
  
  Django Developers Salary, Country Wise
&lt;/h1&gt;

&lt;p&gt;The average Django developer salary in the USA is $100,000 per year or $51.28 per hour. Entry level positions start at $63,375 per year while most experienced workers make up to $140,000 per year.&lt;/p&gt;

&lt;p&gt;For complete details&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://www.talent.com/salary?job=django+developer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  If you are a beginner and want to learn Django so you can check my this blog, I shared top youtube channels and their playlist.
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://pythondjangogeek.com/django/top-youtube-channels-to-learn-django-for-everyone/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  for projects
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://github.com/ShivamRohilllaa/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank You | Shivam Rohilla&lt;/p&gt;

</description>
      <category>django</category>
      <category>career</category>
      <category>resume</category>
      <category>python</category>
    </item>
  </channel>
</rss>
