Skip to content

Commit ceb5049

Browse files
committed
printing parent and child project associations to manage projects template
1 parent c5454fa commit ceb5049

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

ingest/templates/ingest/manage_projects.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ <h1>Manage Projects</h1>
2020
<th>Funded By</th>
2121
<th>Consortia Affiliation</th>
2222
<th>Parent Project Affiliation</th>
23+
<th>Child Project Affiliations</th>
2324
<th>Personnel</th>
2425
<th>Submissions</th>
2526
</tr>
@@ -30,7 +31,8 @@ <h1>Manage Projects</h1>
3031
<td>{{ project.name }}</td>
3132
<td>{{ project.funded_by }}</td>
3233
<td>{{ project.short_names }}</td>
33-
<td>{{ project.parent_project }}</td>
34+
<td>{{ project.parent_project_names }}</td>
35+
<td>{{ project.child_project_names }}</td>
3436

3537
<td><a href="{% url 'ingest:view_project_people' project.id %}">View Personnel</td>
3638
<td><a href="{% url 'ingest:view_project_collections' project.id %}">View Submissions</td>

ingest/views.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,21 @@ def manageProjects(request):
209209
project_consortia = ProjectConsortium.objects.filter(project_id=project.id).all()
210210
project.short_names = []
211211
for c in project_consortia:
212-
short_name = Consortium.objects.get(id=c.id).short_name
212+
short_name = Consortium.objects.get(id=c.consortium_id).short_name
213213
project.short_names.append(short_name)
214214
project.short_names = ', '.join(project.short_names)
215-
# project.parent_project = ProjectAssociation.objects.get(project_id=project.id)
215+
216+
proj_assocs = ProjectAssociation.objects.filter(project_id=project.id).all()
217+
project.parent_project_names = []
218+
project.child_project_names = []
219+
for p in proj_assocs:
220+
parent_project_name = Project.objects.get(id=p.parent_project_id).name
221+
child_project_name = Project.objects.get(id=p.project_id).name
222+
project.parent_project_names.append(parent_project_name)
223+
project.child_project_names.append(child_project_name)
224+
project.parent_project_names = ', '.join(project.parent_project_names)
225+
project.child_project_names = ', '.join(project.child_project_names)
226+
216227
return render(request, 'ingest/manage_projects.html', {'allprojects':allprojects, 'pi':pi})
217228

218229
# this functions allows pi to see all the collections

0 commit comments

Comments
 (0)