fix issues getting correct changesets as an authenticated user

This commit is contained in:
Laura Klünder 2017-06-18 21:09:29 +02:00
parent b6d2445250
commit 3d237e8a62
2 changed files with 2 additions and 2 deletions

View file

@ -165,7 +165,7 @@ class ChangeSet(models.Model):
def qs_for_request(cls, request): def qs_for_request(cls, request):
qs = cls.qs_base() qs = cls.qs_base()
if request.user.is_authenticated: if request.user.is_authenticated:
qs = qs.filter(Q(author__isnull=True) | Q(author=request.user)) qs = qs.filter(Q(author__isnull=False) | Q(author=request.user))
else: else:
qs = qs.filter(author__isnull=True) qs = qs.filter(author__isnull=True)
return qs return qs

View file

@ -181,7 +181,7 @@ USE_TZ = True
REST_FRAMEWORK = { REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': ( 'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication', 'rest_framework.authentication.SessionAuthentication',
), ),
'DEFAULT_PERMISSION_CLASSES': ( 'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.AllowAny', 'rest_framework.permissions.AllowAny',