Skip to content

Commit

Permalink
removed otc notice option from admin
Browse files Browse the repository at this point in the history
  • Loading branch information
arojas1 committed Oct 4, 2024
1 parent 47944ce commit 4a3572e
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 7 deletions.
7 changes: 5 additions & 2 deletions api/versioned/v2/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from django.urls import path, re_path
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView
from drf_spectacular.views import (
SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView
)
from .views import *

multisearch = MultiProjectListDetail.as_view({
Expand Down Expand Up @@ -28,6 +30,7 @@
name="api-projects-date-modified"
),

# For Developers: Reminder to add the local server to the servers list below for testing.
path('schema/', SpectacularAPIView.as_view(
api_version='v2',
custom_settings= {
Expand All @@ -40,7 +43,7 @@
{
'url': 'https://sandbox.localcontextshub.org/api/v2/',
'description': 'Sandbox/Testing site for the Local Contexts Hub API.'
},
}
],
}
), name='schema'
Expand Down
2 changes: 1 addition & 1 deletion communities/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ def project_actions(request, pk, project_uuid):
if not member_role or not request.user.is_authenticated or not project.can_user_access(request.user):
return redirect('view-project', project_uuid)
else:
notices = Notice.objects.filter(project=project, archived=False)
notices = Notice.objects.filter(project=project, archived=False).exclude(notice_type='open_to_collaborate')
creator = ProjectCreator.objects.get(project=project)
current_status = ProjectStatus.objects.filter(project=project, community=community).first()
statuses = ProjectStatus.objects.filter(project=project)
Expand Down
2 changes: 1 addition & 1 deletion institutions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ def project_actions(request, pk, project_uuid):
):
return redirect("view-project", project_uuid)
else:
notices = Notice.objects.filter(project=project, archived=False)
notices = Notice.objects.filter(project=project, archived=False).exclude(notice_type='open_to_collaborate')
creator = ProjectCreator.objects.get(project=project)
statuses = ProjectStatus.objects.select_related("community").filter(
project=project
Expand Down
5 changes: 5 additions & 0 deletions localcontexts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,11 @@ class NoticeAdmin(admin.ModelAdmin):
'institution__institution_name'
)

def formfield_for_choice_field(self, db_field, request, **kwargs):
if db_field.name == 'notice_type':
kwargs['choices'] = [choice for choice in db_field.choices if choice[0] != 'open_to_collaborate']
return super().formfield_for_choice_field(db_field, request, **kwargs)


class OpenToCollaborateNoticeURLAdmin(admin.ModelAdmin):
list_display = ('institution', 'researcher', 'name', 'url', 'added')
Expand Down
2 changes: 1 addition & 1 deletion projects/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def view_project(request, unique_id):
return render(request, '404.html', status=404)

sub_projects = Project.objects.filter(source_project_uuid=project.unique_id).values_list('unique_id', 'title')
notices = Notice.objects.filter(project=project, archived=False)
notices = Notice.objects.filter(project=project, archived=False).exclude(notice_type='open_to_collaborate')

communities = None
institutions = None
Expand Down
4 changes: 3 additions & 1 deletion researchers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,9 @@ def project_actions(request, pk, project_uuid):
if not user_can_view or not project.can_user_access(request.user):
return redirect('view-project', project.unique_id)
else:
notices = Notice.objects.filter(project=project, archived=False)
notices = Notice.objects.filter(project=project, archived=False).exclude(
notice_type='open_to_collaborate'
)
creator = ProjectCreator.objects.get(project=project)
statuses = ProjectStatus.objects.select_related('community').filter(
project=project
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/_project-actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ <h2 class="mr-8 pointer" onclick="toggleSectionInfo(this, 'projectNoticesDiv')">
<img class="pointer-event-none" loading="lazy" src="{{ notice.img_url }}" width="78" height="78" alt="BC Notice icon. Black background with the top right corner folded and the letters “BC” in white in center.">
{% elif notice.notice_type == 'traditional_knowledge' %}
<img class="pointer-event-none" loading="lazy" src="{{ notice.img_url }}" width="78" height="78" alt="TK Notice icon. Black background with the top right corner folded and the letters “TK” in white in center.">
{% else %}
{% elif notice.notice_type == 'attribution_incomplete' %}
<img class="pointer-event-none" loading="lazy" src="{{ notice.img_url }}" width="78" height="78" alt="Attribution Incomplete Notice icon. Black square with the top right corner folded and a white square in center with left side in solid line and right side in dotted line.">
{% endif %}
</div>
Expand Down

0 comments on commit 4a3572e

Please sign in to comment.