diff --git a/coldfront/core/allocation/forms.py b/coldfront/core/allocation/forms.py index fc3b63a5a..44bcb8135 100644 --- a/coldfront/core/allocation/forms.py +++ b/coldfront/core/allocation/forms.py @@ -308,7 +308,7 @@ class AllocationSearchForm(forms.Form): resource_name = forms.ModelMultipleChoiceField( label='Resource Name', queryset=Resource.objects.filter( - is_allocatable=True).order_by(Lower('name')), + is_public=True).order_by(Lower('name')), required=False) allocation_attribute_name = forms.ModelChoiceField( label='Allocation Attribute Name', diff --git a/coldfront/core/allocation/management/commands/change_allocation_project.py b/coldfront/core/allocation/management/commands/change_allocation_project.py new file mode 100644 index 000000000..a17abf8ad --- /dev/null +++ b/coldfront/core/allocation/management/commands/change_allocation_project.py @@ -0,0 +1,22 @@ +"""Change the Project of the Allocation with the given ID to the project with the given title.""" +from django.core.management.base import BaseCommand +from coldfront.core.allocation.models import Allocation +from coldfront.core.project.models import Project + +class Command(BaseCommand): + help = 'Change the Project of the Allocation with the given ID to the project with the given title.' + + def add_arguments(self, parser): + parser.add_argument('allocation_id', type=int) + parser.add_argument('project_title', type=str) + + def handle(self, *args, **options): + allocation_id = options['allocation_id'] + project_title = options['project_title'] + allocation = Allocation.objects.get(pk=allocation_id) + project = Project.objects.get(title=project_title) + allocation.project = project + allocation.save() + self.stdout.write(self.style.SUCCESS(f'Allocation {allocation_id} is now in project {project_title}')) + return + diff --git a/coldfront/core/portal/views.py b/coldfront/core/portal/views.py index 19004605d..cd3921e51 100644 --- a/coldfront/core/portal/views.py +++ b/coldfront/core/portal/views.py @@ -203,6 +203,10 @@ def help_page(request): 'href': 'coldfront-allocation-management', 'title': 'Coldfront Usage Guide', }, + { + 'href': 'roles-responsibilities', + 'title': 'Project User Roles Overview', + }, ], 'Storage Documentation':[ { diff --git a/coldfront/core/utils/fasrc.py b/coldfront/core/utils/fasrc.py index 02fe034c3..9bcce0dfa 100644 --- a/coldfront/core/utils/fasrc.py +++ b/coldfront/core/utils/fasrc.py @@ -2,6 +2,7 @@ """ import os import json +import logging import operator from functools import reduce from datetime import datetime @@ -15,6 +16,7 @@ from coldfront.core.project.models import Project from coldfront.core.resource.models import Resource +logger = logging.getLogger(__name__) MISSING_DATA_DIR = './local_data/missing/' @@ -74,7 +76,7 @@ def select_one_project_allocation(project_obj, resource_obj, dirpath): return allocations[0] elif len(allocations) > 1: print(allocations) - logger.exception('multiple allocations found for project/resource/path pairing: %s', allocations) + logger.exception('multiple allocations found for project/resource/path pairing: %s %s', allocations, allocations[0].path) raise Exception('multiple allocations found for project/resource/path pairing') def determine_size_fmt(byte_num):