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

Development #354

Merged
merged 5 commits into from
Dec 12, 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
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
Loading