'Checking the course already exists in db.'

def clean(self):

    cleaned_data = super(CourseAccessRoleForm, self).clean()
    if (not self.errors):
        if CourseAccessRole.objects.filter(user=cleaned_data.get('email'), org=cleaned_data.get('org'), course_id=cleaned_data.get('course_id'), role=cleaned_data.get('role')).exists():
            raise forms.ValidationError('Duplicate    Record.')
    return cleaned_data
