pinax-referrals
pinax-referrals copied to clipboard
Prevent duplicates of ReferralResponse entries
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
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.