Skip to content

Commit 9a524b0

Browse files
committed
printing parent and child projects
1 parent ceb5049 commit 9a524b0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ingest/views.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,18 @@ def manageProjects(request):
214214
project.short_names = ', '.join(project.short_names)
215215

216216
proj_assocs = ProjectAssociation.objects.filter(project_id=project.id).all()
217+
parent_proj_assocs = ProjectAssociation.objects.filter(parent_project_id=project.id).all()
218+
217219
project.parent_project_names = []
218-
project.child_project_names = []
219220
for p in proj_assocs:
220221
parent_project_name = Project.objects.get(id=p.parent_project_id).name
221-
child_project_name = Project.objects.get(id=p.project_id).name
222222
project.parent_project_names.append(parent_project_name)
223-
project.child_project_names.append(child_project_name)
224223
project.parent_project_names = ', '.join(project.parent_project_names)
224+
225+
project.child_project_names = []
226+
for pa in parent_proj_assocs:
227+
child_project_name = Project.objects.get(id=pa.project_id).name
228+
project.child_project_names.append(child_project_name)
225229
project.child_project_names = ', '.join(project.child_project_names)
226230

227231
return render(request, 'ingest/manage_projects.html', {'allprojects':allprojects, 'pi':pi})

0 commit comments

Comments
 (0)