views:

33

answers:

1

Hello, I am trying develop a basic referrer system to my Django website, system will be generating a unique url for each users to share with their friends. Once these friends enter this website, system somehow keep the data that "this user is browsing by the reference of X user" and once this invited person decided to register for an account, system will save this information (maybe as an extra Foreign Key of the inviting user in the UserProfile model)

Now how can I keep track of the inviting user from the moment entering using the referred link to the point where he/she registers to the site. Would session framework work on this? If not how could this be done ?

+1  A: 

I implemented this feature in my book 'Django 1.0 Website Development'. You can view the relevant chapter online at 'inviting friends via email'.

I used the sessions framework to track clicks on referral links. When a link is clicked, the session is populated with the id of the invitation. When the user registers, the session is checked for an invitation id.

The formatting of the code is a bit off on that page. I've just noticed this. I will let the publisher know. You can download the source code with proper formatting from the book's page.

Ayman Hourieh