From 5de40bdfdd79c0995a6695bd9d4606975e3f6b1c Mon Sep 17 00:00:00 2001 From: j Date: Thu, 27 Jul 2017 21:55:48 +0200 Subject: [PATCH] user --- pandora/archive/models.py | 2 +- pandora/archive/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora/archive/models.py b/pandora/archive/models.py index 06f88ef78..9889601d9 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -435,7 +435,7 @@ class File(models.Model): if k not in keys: del data[k] can_see_media = False - if not user.is_anonymous(): + if user and not user.is_anonymous(): can_see_media = user.profile.capability('canSeeMedia') or \ user.is_staff or \ self.item.user == user or \ diff --git a/pandora/archive/views.py b/pandora/archive/views.py index 9cdde30bf..5dcf79212 100644 --- a/pandora/archive/views.py +++ b/pandora/archive/views.py @@ -479,7 +479,7 @@ def editMedia(request, data): update = True if update: f.save() - response['data']['files'].append(f.json()) + response['data']['files'].append(f.json(user=request.user)) else: response['data']['files'].append({'id': info['id'], 'error': 'permission denied'}) if ignore: