'Redirect to dashboard if the course is blocked due to non-payment.'

def _redirect_if_needed_to_pay_for_course(self):

    self.real_user = User.objects.prefetch_related('groups').get(id=self.real_user.id)
    redeemed_registration_codes = CourseRegistrationCode.objects.filter(course_id=self.course_key, registrationcoderedemption__redeemed_by=self.real_user)
    if is_course_blocked(self.request, redeemed_registration_codes, self.course_key):
        log.warning(u'User    %s    cannot    access    the    course    %s    because    payment    has    not    yet    been    received', self.real_user, unicode(self.course_key))
        raise CourseAccessRedirect(reverse('dashboard'))
