Skip to content

Commit b4386b2

Browse files
Merge pull request #353 from fasrc/cp_minor_tweaks
minor tweaks
2 parents 2669faf + 60e34a4 commit b4386b2

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

coldfront/core/allocation/forms.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ class AllocationSearchForm(forms.Form):
308308
resource_name = forms.ModelMultipleChoiceField(
309309
label='Resource Name',
310310
queryset=Resource.objects.filter(
311-
is_allocatable=True).order_by(Lower('name')),
311+
is_public=True).order_by(Lower('name')),
312312
required=False)
313313
allocation_attribute_name = forms.ModelChoiceField(
314314
label='Allocation Attribute Name',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""Change the Project of the Allocation with the given ID to the project with the given title."""
2+
from django.core.management.base import BaseCommand
3+
from coldfront.core.allocation.models import Allocation
4+
from coldfront.core.project.models import Project
5+
6+
class Command(BaseCommand):
7+
help = 'Change the Project of the Allocation with the given ID to the project with the given title.'
8+
9+
def add_arguments(self, parser):
10+
parser.add_argument('allocation_id', type=int)
11+
parser.add_argument('project_title', type=str)
12+
13+
def handle(self, *args, **options):
14+
allocation_id = options['allocation_id']
15+
project_title = options['project_title']
16+
allocation = Allocation.objects.get(pk=allocation_id)
17+
project = Project.objects.get(title=project_title)
18+
allocation.project = project
19+
allocation.save()
20+
self.stdout.write(self.style.SUCCESS(f'Allocation {allocation_id} is now in project {project_title}'))
21+
return
22+

coldfront/core/portal/views.py

+4
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ def help_page(request):
203203
'href': 'coldfront-allocation-management',
204204
'title': 'Coldfront Usage Guide',
205205
},
206+
{
207+
'href': 'roles-responsibilities',
208+
'title': 'Project User Roles Overview',
209+
},
206210
],
207211
'Storage Documentation':[
208212
{

coldfront/core/utils/fasrc.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
import os
44
import json
5+
import logging
56
import operator
67
from functools import reduce
78
from datetime import datetime
@@ -15,6 +16,7 @@
1516
from coldfront.core.project.models import Project
1617
from coldfront.core.resource.models import Resource
1718

19+
logger = logging.getLogger(__name__)
1820

1921
MISSING_DATA_DIR = './local_data/missing/'
2022

@@ -74,7 +76,7 @@ def select_one_project_allocation(project_obj, resource_obj, dirpath):
7476
return allocations[0]
7577
elif len(allocations) > 1:
7678
print(allocations)
77-
logger.exception('multiple allocations found for project/resource/path pairing: %s', allocations)
79+
logger.exception('multiple allocations found for project/resource/path pairing: %s %s', allocations, allocations[0].path)
7880
raise Exception('multiple allocations found for project/resource/path pairing')
7981

8082
def determine_size_fmt(byte_num):

0 commit comments

Comments
 (0)