'Get all badges for the username specified.'

def get_queryset(self):

    queryset = BadgeAssertion.objects.filter(user__username=self.kwargs['username'])
    provided_course_id = self.request.query_params.get('course_id')
    if (provided_course_id == '*'):
        course_id = None
    elif provided_course_id:
        try:
            course_id = CourseKey.from_string(provided_course_id)
        except InvalidKeyError:
            raise InvalidCourseKeyError
    elif ('slug' not in self.request.query_params):
        course_id = None
    else:
        course_id = CourseKeyField.Empty
    if (course_id is not None):
        queryset = queryset.filter(badge_class__course_id=course_id)
    if self.request.query_params.get('slug'):
        queryset = queryset.filter(badge_class__slug=self.request.query_params['slug'], badge_class__issuing_component=self.request.query_params.get('issuing_component', ''))
    return queryset
