SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 9cc40e95 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

fix fellowships from nomination not being saved

parent f1b893b7
No related branches found
No related tags found
No related merge requests found
...@@ -1053,6 +1053,7 @@ def _hx_fellowship_invitation_update_response(request, invitation_id): ...@@ -1053,6 +1053,7 @@ def _hx_fellowship_invitation_update_response(request, invitation_id):
nonexpired_fellowship = ( nonexpired_fellowship = (
Fellowship.objects.exclude( Fellowship.objects.exclude(
until_date__lte=timezone.now().date(), until_date__lte=timezone.now().date(),
status=Fellowship.STATUS_GUEST,
) )
.filter( .filter(
college=invitation.nomination.college, college=invitation.nomination.college,
...@@ -1065,7 +1066,7 @@ def _hx_fellowship_invitation_update_response(request, invitation_id): ...@@ -1065,7 +1066,7 @@ def _hx_fellowship_invitation_update_response(request, invitation_id):
# Create a new Fellowship if no object exists # Create a new Fellowship if no object exists
if not nonexpired_fellowship: if not nonexpired_fellowship:
start_date = invitation.postpone_start_to or timezone.now() start_date = invitation.postpone_start_to or timezone.now()
fellowship = Fellowship.objects.create( nonexpired_fellowship = Fellowship.objects.create(
college=invitation.nomination.college, college=invitation.nomination.college,
contributor=invitation.nomination.profile.contributor, contributor=invitation.nomination.profile.contributor,
start_date=start_date, start_date=start_date,
...@@ -1073,11 +1074,12 @@ def _hx_fellowship_invitation_update_response(request, invitation_id): ...@@ -1073,11 +1074,12 @@ def _hx_fellowship_invitation_update_response(request, invitation_id):
) )
invitation.nomination.add_event( invitation.nomination.add_event(
description=f"Fellowship created (start: {fellowship.start_date.strftime('%Y-%m-%d')})", description=f"Fellowship created (start: {nonexpired_fellowship.start_date.strftime('%Y-%m-%d')})",
by=request.user.contributor, by=request.user.contributor,
) )
invitation.nomination.fellowship = fellowship invitation.nomination.fellowship = nonexpired_fellowship
invitation.nomination.save()
# else: # else:
# # Update the start date of the Fellowship if an object already exists # # Update the start date of the Fellowship if an object already exists
# nonexpired_fellowship.start_date = ( # nonexpired_fellowship.start_date = (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment