PageView

Stories about Python, Django and Web Development

Django Tips #4 Automatic DateTime Fields

Both Django’s DateTimeField and DateField have two very useful arguments for automatically managing date and time. If you want keep track on when a specific instance was created or updated you don’t need to do it manually: just set the auto_now and auto_now_add arguments to True like in the following example:

Read more



Django Tips #3 Optimize Database Queries

This is a very simple trick that can help you optimize your database queries using the Django ORM.

Read more



How to Setup a SSL Certificate on Nginx for a Django Application

Serving a HTTPS only Django Application is very important to secure your users data. If your application have user authentication it is already a good reason to start using HTTPS only. Otherwise usernames and passwords will be exposed traveling over HTTP in plain text. Meaning if a user is using a public internet connection, and he logs in your application, he is vulnerable to a sniffer attack.

Read more



Django Tips #2 humanize

Django comes with a set of template filters to add a “human touch” to your data. It is used to translate numbers and dates into a human readable format.

Read more



Django Tips #1 redirect

from django.shortcuts import redirect

Read more