fix error in application-supporters an assignment-candidates, for non admin users
This commit is contained in:
parent
1a1bcb2358
commit
ab33b9f05a
@ -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:
|
||||
|
@ -54,7 +54,7 @@
|
||||
<form action="" method="post">{% csrf_token %}
|
||||
{% if perms.assignment.can_nominate_self %}
|
||||
<p>
|
||||
{% if user in assignment.candidates %}
|
||||
{% if user_is_candidate %}
|
||||
<a href='{% url assignment_delrun assignment.id %}'>
|
||||
<span class="button">
|
||||
<span class="icon removeuser">{% trans 'Withdraw self candidature' %}</span>
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
@ -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'):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user