Example #1
0
    class EntryForm(BaseEntryForm):
        PAY_FRACTION_CHOICES = [
            ('4/5', '80%'),
            ('9/10', '90%'),
            ('1', '100%'),
        ]
        option = forms.CharField(min_length=1, max_length=1, required=False,
                                 help_text='The option for this study leave.  A, B, C, etc',
                                 widget=forms.TextInput(attrs={'size': '1'}))
        pay_fraction = fields.FractionField(choices=PAY_FRACTION_CHOICES)
        report_received = forms.BooleanField(label='Report Received?', initial=False, required=False)
        report_received_date = fields.SemesterField(required=False, semester_start=False)
        teaching_decrease = fields.TeachingReductionField()
        deferred_salary = forms.BooleanField(label='Deferred Salary?', initial=False, required=False)
        accumulated_credits = forms.IntegerField(label='Accumulated Credits', min_value=0, max_value=99,
                                                 help_text='Accumulated unused credits', required=False)
        study_leave_credits = forms.IntegerField(label='Study Leave Credits Spent', min_value=0, max_value=99,
                                                 help_text='Total number of Study Leave Credits spent for entire leave')
        credits_forward = forms.IntegerField(label='Study Leave Credits Carried Forward', required=False, min_value=0,
                                             max_value=10000,
                                             help_text='Study Credits Carried Forward After Leave (may be left blank if unknown)')

        def post_init(self):
            # finding the teaching load and set the decrease to that value
            if (self.person):
                from faculty.util import ReportingSemester
                from faculty.processing import FacultySummary
                semester = ReportingSemester(self.initial['start_date'])
                teaching_load = abs(FacultySummary(self.person).teaching_credits(semester)[1])
            else:
                teaching_load = 0

            self.fields['teaching_decrease'].initial = teaching_load
Example #2
0
 class EntryForm(BaseEntryForm):
     REASONS = Choices(
         ('MEDICAL', 'Medical'),
         ('PARENTAL', 'Parental'),
         ('ADMIN', 'Admin'),
         ('LOA', 'Leave of Absence'),
         ('SECONDMENT', 'Secondment'),
     )
     reason = forms.ChoiceField(label='Type', choices=REASONS)
     leave_fraction = fields.FractionField(help_text="Fraction of salary received during leave eg. '3/4' indicates 75% pay",
                                           label='Work fraction', initial=1)
     teaching_credits = fields.TeachingCreditField()
     teaching_load_decrease = fields.TeachingReductionField()