Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question #43

Closed
nurzhannogerbek opened this issue May 21, 2018 · 1 comment
Closed

Question #43

nurzhannogerbek opened this issue May 21, 2018 · 1 comment

Comments

@nurzhannogerbek
Copy link

Hello! :)

I am trying to create referral system in my Django project. I found your very interesting app and want to test it for this task.

From documentation its not clear how correctly to use it and there is no example. As I understand we need make next steps:

  1. Create Profile models with such code:
from django.contrib.auth.models import User
from django.dispatch import receiver
from account.signals import user_signed_up  # django-user-account app
from pinax.referrals.models import Referral

class Profile(models.Model):
    user = models.OneToOneField(User,on_delete=models.CASCADE)
    referral = models.OneToOneField(Referral, null=True, on_delete=models.CASCADE)

@receiver(user_signed_up)
def handle_user_signed_up(sender, user, form, **kwargs):
    Referral.create(redirect_to=user.profile.get_absolute_url())
  1. Сreate custom signup view:
from account.views import SignupView
from pinax.referrals.models import Referral


class RegistrationView(SignupView):

    def after_signup(self, form):
        super(RegistrationView, self).after_signup(form)
        Referral.record_response(self.request, "USER_SIGNUP")

How correct are my steps? Could you give a simple example for the understanding please?

@KatherineMichel
Copy link
Member

Closing this issue as an apparent duplicate of #44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants