Skip to content

Commit 0db325d

Browse files
authored
Merge pull request #212 from brain-image-library/errors/DoesNotExist
added error handling if a user has not been added to the People table…
2 parents 3d739f3 + 20577f8 commit 0db325d

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

ingest/templates/ingest/index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
{% block content %}
44

55
<div class="container-fluid white_on_gray">
6-
<div class="row">
76

7+
<div class="row">
88
<div class="col-lg-12 big-row-text">
99
<h1>Data Submission Portal</h1>
1010
<p>The Brain Image Library (BIL) is a public resource enabling
@@ -19,8 +19,14 @@ <h1>Data Submission Portal</h1>
1919
</div>
2020

2121
</div>
22+
{% for message in messages %}
23+
<div style="width: px; margin-left:0px; " class="alert alert-{{ message.tags }} " id="msg" role="alert">
24+
{{ message }}
25+
26+
{% endfor %}
2227
</div>
2328

29+
2430
{% if request.user.username %}
2531

2632
<div class="container-fluid gray_on_med_blue">

ingest/views.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,12 @@ def collection_send(request):
479479
@login_required
480480
def collection_create(request):
481481
current_user = request.user
482-
people = People.objects.get(auth_user_id_id = current_user.id)
483-
project_person = ProjectPeople.objects.filter(people_id = people.id).all()
482+
try:
483+
people = People.objects.get(auth_user_id_id = current_user.id)
484+
project_person = ProjectPeople.objects.filter(people_id = people.id).all()
485+
except ObjectDoesNotExist:
486+
messages.info(request, 'Error: Your account is likely not fully set up. Follow along with your Sign Up ticket on bil-support and provide the appropriate Grant Name and Number to the Project you will be submitting for. If you have already done so, kindly nudge us to complete your account creation.')
487+
return redirect('/')
484488
for attribute in project_person:
485489
if attribute.is_pi:
486490
pi = True
@@ -2194,8 +2198,12 @@ def check_all_sheets(filename):
21942198
@login_required
21952199
def descriptive_metadata_upload(request):
21962200
current_user = request.user
2197-
people = People.objects.get(auth_user_id_id = current_user.id)
2198-
project_person = ProjectPeople.objects.filter(people_id = people.id).all()
2201+
try:
2202+
people = People.objects.get(auth_user_id_id = current_user.id)
2203+
project_person = ProjectPeople.objects.filter(people_id = people.id).all()
2204+
except:
2205+
messages.info(request, 'Error: Your account is likely not fully set up. Follow along with your Sign Up ticket on bil-support and provide the appropriate Grant Name and Number to the Project you will be submitting for. If you have already done so, kindly nudge us to complete your account creation.')
2206+
return redirect('/')
21992207
for attribute in project_person:
22002208
if attribute.is_pi:
22012209
pi = True

0 commit comments

Comments
 (0)