• Posted by allwinraju
  • December 20, 2020
  • 0 Comments

Cookies in Django – Setting, retrieving and deleting cookies

HTTP is a stateless protocol so when a request is sent to the server, it does not know whether you are requesting the page for the first time or you are the same user who has visited this page many times before. This HTTP statelessness was a problem for ecommerce website developers because persistence among […]

Read More
  • Posted by allwinraju
  • December 8, 2020
  • 0 Comments

XML response in Django using Django-rest-framework

In this article, we shall see how to return the response from our Django project in XML format instead of the traditional JSON response. We have to install a third-party package first in order to render XML response. REST Framework XML provides a simple informal XML format. It was previously included directly in the REST […]

Read More

Lesser-known methods in Django ORM

We all know Django provides ORM right out of the box thus preventing us from writing SQL queries. This mechanism has a lot of potentials. Most of us will be dealing only with the filter(), get(), all(), update() and delete() methods from the Django ORM. But Django ORM provides a lot of other options in […]

Read More

Django — Get browser and OS info from the HTTP requests

This blog post focuses on finding various information about the nature of the browser and os from which the HTTP requests are made. The following information can be obtained from the requests. If the device is a mobile/PC Browser name Browser version OS of the computer or mobile OS version Device name Let us get […]

Read More

Django update queryset in a single line

I recently came across a problem, where I had to set or alter a boolean field from True to False for all the objects of a queryset. I did not want to use a for loop to iterate over them, change the value from False to True, and save it. I looked over a solution […]

Read More

Create custom manage.py commands in django

Often times during Django project development, there is a need to write one-off scripts that do something. As a self-taught developer, there are many ways to accomplish this, and I for one, did this completely wrong for years. My original strategy as a beginner-interediate level developer was to create view functions that contained my logic alongside URLs that […]

Read More