diff --git a/openslides/application/models.py b/openslides/application/models.py index 4b45a5ed8..6da30fe23 100644 --- a/openslides/application/models.py +++ b/openslides/application/models.py @@ -362,7 +362,7 @@ class Application(models.Model, SlideMixin): is_admin = False if user: try: - user.profile + user = user.profile except Profile.DoesNotExist: is_admin = True except AttributeError: diff --git a/openslides/assignment/templates/assignment/view.html b/openslides/assignment/templates/assignment/view.html index 2614b26d6..cab930676 100644 --- a/openslides/assignment/templates/assignment/view.html +++ b/openslides/assignment/templates/assignment/view.html @@ -54,7 +54,7 @@
{% csrf_token %} {% if perms.assignment.can_nominate_self %}

- {% if user in assignment.candidates %} + {% if user_is_candidate %} {% trans 'Withdraw self candidature' %} diff --git a/openslides/assignment/views.py b/openslides/assignment/views.py index 0b2ef82a0..6320c459b 100644 --- a/openslides/assignment/views.py +++ b/openslides/assignment/views.py @@ -97,11 +97,14 @@ def view(request, assignment_id=None): else: polls = assignment.poll_set.all() vote_results = assignment.vote_results(only_published=False) + + user = user2djangouser(request.user) return { 'assignment': assignment, 'form': form, 'vote_results': vote_results, 'polls': polls, + 'user_is_candidate': assignment.is_candidate(user) } diff --git a/openslides/participant/models.py b/openslides/participant/models.py index 919e03b95..1913da474 100644 --- a/openslides/participant/models.py +++ b/openslides/participant/models.py @@ -58,6 +58,9 @@ class Profile(models.Model, UserMixin): self.user.set_password(self.firstpassword) self.user.save() + def has_perm(self, perm): + return self.user.has_perm(perm) + @models.permalink def get_absolute_url(self, link='edit'): """