クラスベースのビューを呼び出しています
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から
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;
});
});