Skip to content
Snippets Groups Projects
Commit 548ffae3 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Hide the determination button if user cant use it

parent 2fd164ff
No related branches found
No related tags found
No related merge requests found
{% load determination_tags workflow_tags %}
{% if request.user|can_add_determination:submission %}
{% if request.user|show_determination_button:submission %}
<a href="{% url 'apply:submissions:determinations:form' submission_pk=submission.id %}" class="button button--primary button--full-width">
{% if submission.determination.is_draft %}Update draft{% else %}Add determination{% endif %}
</a>
......
from django import template
from django.db.models import ObjectDoesNotExist
from ..views import can_create_determination
from ..views import can_create_determination, can_edit_determination
register = template.Library()
@register.filter
def can_add_determination(user, submission):
return can_create_determination(user, submission)
def show_determination_button(user, submission):
try:
return can_edit_determination(user, submission.determination, submission)
except ObjectDoesNotExist:
return can_create_determination(user, submission)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment