kolios logo

How to extend django's user class and change authentication middleware.

Hi everyone,

Welcome for the first edition for python-friday ! This python friday will be dedicated to the so popular django web framework because I really have my hands in it for the time being.

Django offers a very nice User class to manage all sort of users, set rights, contact information and so on. But sometimes, you want to extend that class to add some extra information.

The problem:
You want to use your – let’s call it – Customer class as the central user class and authenticate using django’s user modules.

The solution:
Extend the user classs to add your data and configure django framework to use your new class as a middleware and authenticate on it.

read the rest of this entry »

22 January 10 sebastien requiem 2 comments

Dynamic loading of python module

Sometimes ago, a friend of mine recommended me to have a look at python language. Very quickly I got hooked by how easy and developer friendly is that language. The language is straight forward and the number of loadable modules is absolutely amazing.

So we go on our python serie with a small piece of code that could be useful for python developers who want to dynamically load ‘packages’ (called on the fly import)

The problem:
Being able to load dynamically (at runtime) some packages to extend your code.

Solution:
in all this tutorial, we will use the so unfamous __import__ python builtin.
read the rest of this entry »

18 January 10 sebastien requiem no comments