fix ChangeSet.is_author for non-saved changesets

This commit is contained in:
Laura Klünder 2017-11-22 22:54:59 +01:00
parent fdf6269000
commit 9ad5c6a5e7

View file

@ -412,8 +412,9 @@ class ChangeSet(models.Model):
return self.state in ('finallyrejected', 'applied')
def is_author(self, request):
return (self.author == request.user or (self.author is None and not request.user.is_authenticated and
request.session.get('changeset', None) == self.pk))
return (self.pk is None or self.author == request.user or
(self.author is None and not request.user.is_authenticated and
request.session.get('changeset', None) == self.pk))
def can_see(self, request):
return self.is_author(request)