def verify_user_campaign(campaign_id, user_id): try: user_campaign = UserCampaign.objects.get(userid=user_id.id, campaign=campaign_id.id, seen_campaign=False) except: pass else: user_campaign = UserCampaign(id=user_campaign.id, userid=user_campaign.userid, campaign=user_campaign.campaign, seen_campaign=True) user_campaign.save()
def save_user_campaign(campaign_id, user_id): try: user_campaign = UserCampaign.objects.get(userid=user_id.id, campaign=campaign_id.id) except: user_campaign = UserCampaign(userid=user_id, campaign=campaign_id) user_campaign.save()