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 the Django web application to render model data. And Django provides a very clear and easy way for you to manage the combination of layout page and content page. So you can define the layout page in one template Html file, and then define the content page in another …

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 learned how to add search result pagination to the user list page in the 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 pages such as dept_list.html …

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