Skip to content

Commit

Permalink
Fix authentication check for django 2.0 (jazzband#445)
Browse files Browse the repository at this point in the history
The method 'user.is_authenticated()' is deprecated,
and it is removed in the v2 release of django.
  • Loading branch information
odinuge authored and jamaalscarlett committed Jan 12, 2018
1 parent d7d9dc9 commit ce7da25
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions push_notifications/api/rest_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ def create(self, request, *args, **kwargs):
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)

def perform_create(self, serializer):
if self.request.user.is_authenticated():
if self.request.user.is_authenticated:
serializer.save(user=self.request.user)
return super(DeviceViewSetMixin, self).perform_create(serializer)

def perform_update(self, serializer):
if self.request.user.is_authenticated():
if self.request.user.is_authenticated:
serializer.save(user=self.request.user)
return super(DeviceViewSetMixin, self).perform_update(serializer)

Expand Down

0 comments on commit ce7da25

Please sign in to comment.