pinax-referrals icon indicating copy to clipboard operation
pinax-referrals copied to clipboard

Prevent duplicates of ReferralResponse entries

Open anilshanbhag opened this issue 10 years ago • 1 comments

Currently when the user visits the referral link, a ReferralResponse entry is created. However if the user opens the same referral link multiple times, this creates multiple entries containing the same data.

I think it would be better to use ReferralResponse.objects.get_or_create(**kwargs) instead of ReferralResponse.objects.create(**kwargs) in the respond method of Referral model

anilshanbhag avatar Mar 11 '14 16:03 anilshanbhag

Some developers might find multiple referrals useful. Instead, there should be an option to make a single record of multiple visits to the same referral. Given that the option can be set to record every visit to the referral code, the ReferralResponse model should provide a convenience function to de-dup the responses.

heliodor avatar Nov 11 '14 18:11 heliodor