From the category archives:

tips

There are some tools and apps which we use with almost all apps we write, and in particular which, we used for dinette. Here they are broken into useful during development, and (also) useful post development.

During Development

Ipython and ipdb South Django test utils Django extensions Django debug toolbar

Ipython and ipdb

Ipython is a enhanced shell for python. Ipdb similarly add extra capacity [...]

{ 23 comments }

What is bpython?

bpython is a fancy interface to the Python interpreter for Unix-like operating system.

says the bpython home page. It provides syntax highlighting, auto completion, auto-indentation and such stuff.

Unlike iPython, which implements then entire shell functions and emulates the standard python shell, and adds enhancements, bpython just adds features on top of the [...]

{ 59 comments }

Django quiz

by shabda on December 3, 2009

A quick django quiz. Answers available tomorrow. Get it as a text file (django-quiz) or on google docs or read below.

### Easy

1. You have a class defined as

class Post(models.Model): name = models.CharField(max_length=100) is_active = models.BooleanField(default=False)

You create multiple [...]

{ 14 comments }

Writing your own template loaders

by shabda on November 21, 2009

Django has three builtin template loaders which are used to get the templates for rendering.

TEMPLATE_LOADERS = ( ‘django.template.loaders.filesystem.load_template_source’, ‘django.template.loaders.app_directories.load_template_source’, # ‘django.template.loaders.eggs.load_template_source’, )

Writing your template loader is a awfuly easy. It is a callable which

Returns a tuple of (openfile, filename) if it can find the template. Raise TemplateDoesNotExist if [...]

{ 6 comments }

A response to Dropping Django

by shabda on August 20, 2009

Brandon Bloom yesterday wrote an interesting post titled dropping Django. Despite a lot of hand waving(We needed a pragmatic template language to replace Django’s idealistic one.), it raises some valid questions, so here is a solution to some of them.

No support for hierarchical url creation.

The simplest representation of nested urls I can think of is a nested [...]

{ 54 comments }

Django aggregation tutorial

by shabda on August 18, 2009

One of the new and most awaited features with Django 1.1 was aggregation. As usual, Django comes with a very comprehensive documentation for this. Here, I have tried to put this in how-to form.

Jump to howtos or Get source on Github.

Essentially, aggregations are nothing but a way to perform an operation on group of rows. In databases, they [...]

{ 26 comments }

On Captcha

by shabda on July 16, 2009

When building public facing websites, spam is a real problem. Captcha has been teated as the first line of defence aginst this problem. If you must use captcha, here are some best practices working with them.

Can you do without one?

A lot of places captcha’s are put to filter spam in user generated comment. One of [...]

{ 1 comment }

Fun with none

by rohit on July 16, 2009

(If you are in a hurry, here is the fun part.

A few days ago, I was working with a nullable field, which wasn’t behaving as I expected. So I started a shell, and see how nulls compare.

In [1]: None

In [2]: None > 10

Out[2]: False

In [3]: None < 10

Out[3]: True

In [4]: None == None

Out[4]: [...]

{ 68 comments }

Django design patterns

by shabda on July 3, 2009

This is announcement about our new work, Django design patterns, a ebook about, well, Django design patterns. (Well imagine that!). Here is the readme copied from there.

[Edit] Syntax highlighting and indentation preservation were totally brroken. Fixed now.

Django design patterns is a book about commonly occuring patterns in Django. Not patterns in Gof sense, but patterns in [...]

{ 14 comments }

Here is a quick tip. (Obvious if you work with Django for any length of time, but I have seen a few people who are not aware)

You can put debug trace import pdb; pdb.set_trace() in your code, and put it on the server. When you access this view from your local browser, the debug is [...]

{ 1 comment }