Skip to content

Commit

Permalink
Merge pull request #353 from fasrc/cp_minor_tweaks
Browse files Browse the repository at this point in the history
minor tweaks
  • Loading branch information
claire-peters authored Dec 12, 2024
2 parents 2669faf + 60e34a4 commit b4386b2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion coldfront/core/allocation/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
@@ -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

4 changes: 4 additions & 0 deletions coldfront/core/portal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':[
{
Expand Down
4 changes: 3 additions & 1 deletion coldfront/core/utils/fasrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
import os
import json
import logging
import operator
from functools import reduce
from datetime import datetime
Expand All @@ -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/'

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit b4386b2

Please sign in to comment.