Get all classes of current user

def classes(request):
    """Get all classes of current user"""

    if not request.user.is_authenticated() or not hasattr(request.user, "userprofile"):
        return render_json(request, {
            'error': _('User is not logged in'),
            'error_type': 'user_unauthorized'
        }, template='user_json.html', status=401)
    clss = [c.to_json() for c in Class.objects.filter(owner=request.user.userprofile)]

    return render_json(request, clss, status=200, template='user_json.html', help_text=classes.__doc__)