March 2012
6 posts
2 tags
Django generic relations and performances:...
django-actream is a
fresh and fantastic pluggable application for django. This article presents the
solution to a simple performance issue: selecting followers and users who
follow me through a generic foreign key … This article targets django users.
The model
At the time this article is written, this is what it looks like:
class Follow(models.Model):
"""
Lets a user follow the...
3 tags
Howto: javascript popup form returning value for...
This article presents a technique to get the return value of a form opened in a
javascript popup, like Django admin for foreign keys. It can be used to improve
the ergonomy relation select inputs.
Introduction
When a form allows to create or edit data, many to one (n:1) relations choices
are often presented in a select input. For example, Django admin uses a select
field by default for foreign...
3 tags
How to override a view from an external Django app
This article describes how to override a view from an external Django app which is a FAQ on StackOverflow and IRC.
You should understand that your urls.py is a really central and critical part of your django project.
You don’t touch external app code
You are not supposed to edit the code from an external app. Unless you fork it first on github.
How to override without...
5 tags
Django, Pinax, virtualenv, setuptools, pip,...
This article describes how to build project dependencies with virtualenv. It is appliable to Pinax.
Pinax uses virtualenv by default. It lets the developer have a project-specific python directory, including binaries, packages etc … OpenSuse for example supplies very bad Pinax packages which allows the user to mess with his operating system. It is much better to isolate project dependencies from a...
1 tag
Disk space WTF
What do you think is the problem when vim starts complaining that it can’t
write swap files, postgresql starts complaining that there is no disk space
left, when df output is:
>>> df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 10240 4 10236 1% /dev
run 10240 156 10084 2% /run
/dev/md1 10403064 ...
Survive linux (*nix) permissions
It is common for junior developers and system administrators to be blocked
because of permissions. This article describes how to identify and fix a
permission issue, as this is a FAQ on StackOverflow.
Identifying permission issues
Here a self explaining case, probably the easiest, which happens when trying to
access something which is directly blocked by the lack permissions:
>>>...