我正在调用基于类的视图
class CurrentUser(APIView):
authentication_classes = (authentication.TokenAuthentication,)
def get(self, request, format=None):
for user in User.objects.all()
if request.user.is_authenticated():
fullname = user.get_full_name()
return Response(fullname)
从网址
url(r'^currentuser$', views.CurrentUser.as_view(), name='current-user'
我正在获取当前用户名。但我想通过以下方式将这些数据带入 angularjs 控制器的 $scope 中。请..任何帮助将不胜感激..
controllersModule.controller('homeCtrl', function($scope, $http, User , Product ,Process ,Ingredient) {
$scope.$on('event:login-confirmed', function() {
$scope.users = User.query();
$scope.products = Product.query();
$scope.processes = Process.query();
$scope.ingredients = Ingredient.query();
// $scope.currentUser = get;
});
});