views:

106

answers:

2

Hello, I have an ecommerce website that works in a classical way: people sign up, buy a product with their CC.

It uses the default Django auth system for users and registration and session framework.

Now I want to implement a referral system to my system where people can invite other people by giving their referral link (ie mysite.com/referral/123123/ ) and if a person signs up AND buys an item, the inviter gets 5$.

How can this the implemented ? For instance:

  • After the new user enters the site with the referral link, how can I keep track of this user with the referrer ? Saving his referrer to the session ?

  • What modification should I do to the built-in django user model to track these referrers and referred ones?

+1  A: 

Define a special set of URLs (in your urls.py) for referral links. Pass them through a Python function that registers the referral and then send them to the normal view with the referral number as a parameter.

Is this what you had in mind, or what else would you like to know?

Eli Bendersky
thanks for your answer, I have updated my question.
Hellnar