Skip to content

Commit

Permalink
Merge pull request #616 from dbca-wa/v2.1.0prod
Browse files Browse the repository at this point in the history
Fix group filter issue
  • Loading branch information
RickWangPerth authored Oct 24, 2024
2 parents 2c0014d + 83e9c48 commit dae5e60
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load static bootstrap4 %}
{% load proper_paginate %}
{% load url_replace %}
{% load group_filters %}
{% load mmi_group_filters %}

{% block extra_style %}
{{ block.super }}
Expand Down Expand Up @@ -146,7 +146,9 @@ <h1 class="incident-title">Marine Mammal Incidents</h1>
<th>Species</th>
<th>Location</th>
<th>Type</th>
{% if request.user|mmi_has_group:"data curator" or request.user.is_superuser or request.user|mmi_has_group:"MARINE_ANIMAL_INCIDENTS"%}
<th>Actions</th>
{% endif %}
</tr>
</thead>
<tbody>
Expand All @@ -156,9 +158,11 @@ <h1 class="incident-title">Marine Mammal Incidents</h1>
<td>{{ incident.species }}</td>
<td>{{ incident.location_name }}</td>
<td>{{ incident.get_incident_type_display }}</td>
{% if request.user|mmi_has_group:"data curator" or request.user.is_superuser or request.user|mmi_has_group:"MARINE_ANIMAL_INCIDENTS"%}
<td>
<a href="{% url 'marine_mammal_incidents:update_incident' incident.id %}" class="btn btn-sm btn-primary">View / Update</a>
</td>
{% endif %}
</tr>
{% empty %}
<tr><td colspan="5">No incidents recorded yet.</td></tr>
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion marine_mammal_incidents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from django.core.exceptions import PermissionDenied

def user_in_marine_animal_incidents_group(user):
return user.is_superuser or user.groups.filter(name='MARINE_ANIMAL_INCIDENTS').exists()
return user.is_superuser or user.groups.filter(name='MARINE_ANIMAL_INCIDENTS') or user.groups.filter(name='data curator').exists()

@user_passes_test(user_in_marine_animal_incidents_group, login_url=None, redirect_field_name=None)
def incident_form(request, pk=None):
Expand Down
Empty file.

0 comments on commit dae5e60

Please sign in to comment.