PageView

Stories about Python, Django and Web Development

Django Tips #8 Blank or Null?

Django Tips #8 Blank or Null?

Django models API offers two similar options that usually cause confusion on many developers: null and blank. When I first started working with Django I couldn’t tell the difference and always ended up using both. Sometimes even using them improperly.

Read more



How to Extend Django User Model

How to Extend Django User Model

The Django’s built-in authentication system is great. For the most part we can use it out-of-the-box, saving a lot of development and testing effort. It fits most of the use cases and is very safe. But sometimes we need to do some fine adjustment so to fit our Web application.

Read more



Django Tips #7 How to Get the Current URL Within a Django Template

Django Tips #7 How to Get the Current URL Within a Django Template

Make sure you have django.template.context_processors.request listed in your context_processors.

Read more



How to Create a Custom Django Middleware

How to Create a Custom Django Middleware

In a nutshell, a Middleware is a regular Python class that hooks into Django’s request/response life cycle. Those classes holds pieces of code that are processed upon every request/response your Django application handles.

Read more



Django Tips #6 get_or_create

Django Tips #6 get_or_create

This is a convenience method for looking up an object, giving a set of parameters, creating one if necessary.

Read more



How to Use Django's Built-in Login System

How to Use Django's Built-in Login System

Django comes with a lot of built-in resources for the most common use cases of a Web application. The registration app is a very good example and a good thing about it is that the features can be used out-of-the-box.

Read more



Date Template Filter

Date Template Filter

List of the most used Django date template filters to format date according to a given format, semantically ordered.

Read more



Django Tips #5 How to Merge QuerySets

Django Tips #5 How to Merge QuerySets

This tip is particularly useful when you want to merge two or more querysets into a single queryset without losing the capabilities of performing filter, count, distinct, etc. operations.

Read more



How to Send Email in a Django App

How to Send Email in a Django App
Sending emails with Django is a really easy task. In this short tutorial I will guide you through the necessary steps to set up your Django Application to start sending emails right away.

Read more



Django Tips #4 Automatic DateTime Fields

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