Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix group filter issue #616

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading