Django:实施推荐程序 [英] Django: Implementing a referral program

查看:97
本文介绍了Django:实施推荐程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个以经典方式工作的电子商务网站:人们注册后,用他们的CC购买产品。

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

它为用户使用默认的Django身份验证系统以及注册和会话框架。

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

现在,我想为我的系统实现一个推荐系统,人们可以通过提供推荐链接来邀请其他人(例如, mysite.com/referral/123123 / ),如果一个人注册并购买了商品,邀请者将获得5美元。

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 ?

我应该对内置的django用户模型进行哪些修改以跟踪这些引荐来源和被引用的引荐来源?

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

推荐答案

定义一组特殊的URL(在您的 url中。 py )以获取推荐链接。将它们通过注册引荐的Python函数传递,然后将引荐编号作为参数发送到普通视图。

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?

这篇关于Django:实施推荐程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆