Python Django

Django Class Based View Vs Function Based View

The Django view function is responsible to process user request and return a django.http.HttpResponse object to client browser. And view function is defined in Django app views.py file. But besides this, you can also define custom view class to achieve same purpose. Your view class should extends Django provided built-in class-based generic views such as …

Django Class Based View Vs Function Based View Read More »

How To Enable Or Disable CSRF Validation In Django Web Application

Django has provide a feature that can help you to avoid csrf attack on your Django application. But some times especially in your development environment, you do not want this feature when send post request to your web server use curl in command line, if this feature enabled, you will get errors. This article will …

How To Enable Or Disable CSRF Validation In Django Web Application Read More »

How To Create Django View Template Files Structure Correctly Use Block & Include Tag

We use template html files in Django web application to render model data. And Django provide a very clear and easy way for you to manage the combination of layout page and content page. So you can define layout page in one template html file, and then define content page in another template html file. …

How To Create Django View Template Files Structure Correctly Use Block & Include Tag Read More »

How To Assign Variables To Child Template Use {% include %} Tag In Django

We have learnt how to add search result pagination in the user list page in article Django Filter And Pagination Example. In that example, we use below html code in DjangoHelloWorld / templates / dept_emp / user_list.html template file to add pagination. But how to add pagination to other list page such as dept_list.html and …

How To Assign Variables To Child Template Use {% include %} Tag In Django Read More »