steambird/boecie/views.py
def form_valid(self, form: Form) -> HttpResponseRedirect:
        """
        Handles logic of when form is valid. Handles the two submit buttons actions, also handles
        creating course-stuyd relation

        :param form: Django Form object
        :return: Django HttpResonseRedirect
        """

        if '_mark_updated' in self.request.POST:
            form.instance.updated_associations = True
        form.save(commit=True)


        study = Study.objects.get(pk=self.kwargs['pk'])
        course = Course.objects.get(course_code=form.cleaned_data['course_code'],
                                    period=form.cleaned_data['period'])
        CourseStudy.objects.create(study=study, course=course,
                                   study_year=int(form.cleaned_data['study_year'])).save()

        return redirect(
            reverse('boecie:study.list', kwargs={'pk': self.kwargs['pk']}))

        Handles logic of when form is valid. Handles the two submit buttons actions, also handles
        creating course-stuyd relation

        :param form: Django Form object
        :return: Django HttpResonseRedirect
        
Handles logic of when form is valid. Handles the two submit buttons actions, also handles
creating course-stuyd relation
Handles logic of when form is valid . Handles the two submit buttons actions also handles creating course - stuyd relation
def form_valid(self, form: Form) -> HttpResponseRedirect:
        if '_mark_updated' in self.request.POST:
            form.instance.updated_associations = True
        form.save(commit=True)
        study = Study.objects.get(pk=self.kwargs['pk'])
        course = Course.objects.get(course_code=form.cleaned_data['course_code'],
                                    period=form.cleaned_data['period'])
        CourseStudy.objects.create(study=study, course=course,
                                   study_year=int(form.cleaned_data['study_year'])).save()
        return redirect(
            reverse('boecie:study.list', kwargs={'pk': self.kwargs['pk']}))
def form_valid ( self , form : Form ) -> HttpResponseRedirect : if '_mark_updated' in self . request . POST : form . instance . updated_associations = True form . save ( commit = True ) study = Study . objects . get ( pk = self . kwargs [ 'pk' ] ) course = Course . objects . get ( course_code = form . cleaned_data [ 'course_code' ] , period = form . cleaned_data [ 'period' ] ) CourseStudy . objects . create ( study = study , course = course , study_year = int ( form . cleaned_data [ 'study_year' ] ) ) . save ( ) return redirect ( reverse ( 'boecie:study.list' , kwargs = { 'pk' : self . kwargs [ 'pk' ] } ) )
Handles logic of when form is valid.
Handles logic of when form is valid .
"""
        Handles logic of when form is valid. Handles the two submit buttons actions, also handles
        creating course-stuyd relation

        :param form: Django Form object
        :return: Django HttpResonseRedirect
        """
None
self
form
Form
Django Form object
Django Form object