SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 36eefea3 authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Fix bug in creating ThesisLink

Creating a new ThesisLink didn't save the `requested_by`
 field, causing trouble in for example the vet view
 for these specific objects.
parent b2648551
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,10 @@ class VetThesisLinkForm(RequestThesisLinkForm):
justification = forms.CharField(widget=forms.Textarea(
attrs={'rows': 5, 'cols': 40}), label='Justification (optional)', required=False)
def __init__(self, *args, **kwargs):
super(VetThesisLinkForm, self).__init__(*args, **kwargs)
self.order_fields(['action_option', 'refusal_reason', 'justification'])
def vet_request(self, thesislink, user):
if int(self.cleaned_data['action_option']) == VetThesisLinkForm.ACCEPT:
thesislink.vetted = True
......
......@@ -38,6 +38,7 @@ class RequestThesisLink(CreateView):
success_url = reverse_lazy('scipost:personal_page')
def form_valid(self, form):
form.instance.requested_by = self.request.user.contributor
messages.add_message(self.request, messages.SUCCESS,
strings.acknowledge_request_thesis_link)
return super(RequestThesisLink, self).form_valid(form)
......
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