|
27 | 27 | from .field_list import required_metadata
|
28 | 28 | from .filters import CollectionFilter
|
29 | 29 | from .forms import CollectionForm, ImageMetadataForm, DescriptiveMetadataForm, UploadForm, collection_send
|
30 |
| -from .models import UUID, Collection, ImageMetadata, DescriptiveMetadata, Project, ProjectPeople, People, Project, EventsLog, Contributor, Funder, Publication, Instrument, Dataset, Specimen, Image, Sheet, Consortium |
| 30 | +from .models import UUID, Collection, ImageMetadata, DescriptiveMetadata, Project, ProjectPeople, People, Project, EventsLog, Contributor, Funder, Publication, Instrument, Dataset, Specimen, Image, Sheet, Consortium, ProjectConsortium |
31 | 31 | from .tables import CollectionTable, DescriptiveMetadataTable, CollectionRequestTable
|
32 | 32 | import uuid
|
33 | 33 | import datetime
|
@@ -202,7 +202,8 @@ def manageProjects(request):
|
202 | 202 | for row in project_person:
|
203 | 203 | project_id = row.project_id_id
|
204 | 204 | project = Project.objects.get(id=project_id)
|
205 |
| - allprojects.append(project) |
| 205 | + allprojects.append(project) |
| 206 | + |
206 | 207 |
|
207 | 208 | return render(request, 'ingest/manage_projects.html', {'allprojects':allprojects, 'pi':pi})
|
208 | 209 |
|
@@ -244,19 +245,27 @@ def project_form(request):
|
244 | 245 | @login_required
|
245 | 246 | def create_project(request):
|
246 | 247 | new_project = json.loads(request.body)
|
| 248 | + print(new_project) |
247 | 249 | items = []
|
248 | 250 | for item in new_project:
|
249 | 251 | items.append(item['funded_by'])
|
250 |
| - items.append(item['is_biccn']) |
251 | 252 | items.append(item['name'])
|
252 |
| - |
| 253 | + items.append(item['consortia_ids']) |
| 254 | + |
253 | 255 | funded_by = item['funded_by']
|
254 |
| - is_biccn = item['is_biccn'] |
255 | 256 | name = item['name']
|
256 |
| - |
| 257 | + consortia_ids = item['consortia_ids'] |
| 258 | + |
257 | 259 | # write project to the project table
|
258 |
| - project = Project(funded_by=funded_by, is_biccn=is_biccn, name=name) |
| 260 | + project = Project(funded_by=funded_by, name=name) |
259 | 261 | project.save()
|
| 262 | + |
| 263 | + proj_id = project.id |
| 264 | + |
| 265 | + for c in consortia_ids: |
| 266 | + project_consortium = ProjectConsortium(project_id=proj_id, consortium_id=c) |
| 267 | + project_consortium.save() |
| 268 | + |
260 | 269 |
|
261 | 270 | # create a project_people row for this pi so they can view project on pi dashboard
|
262 | 271 | project_id_id = project.id
|
|
0 commit comments