How to use the ta.models.TAPosting.objects function in ta

To help you get started, we’ve selected a few ta examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sfu-fas / coursys / coredata / devtest_importer.py View on Github external
else:
            payargs = {'lump_sum_pay': 4000, 'biweekly_pay': 0, 'pay_periods': 8, 'hourly_pay': 0, 'hours': 0}
        ra = RAAppointment(person=p, sin=123456789, hiring_faculty=s, unit=unit, hiring_category=c,
                           project=random.choice([proj1,proj2]), account=acct, pay_frequency=freq,
                           start_date=config.start_date(), end_date=config.end_date(),
                           **payargs)
        ra.set_use_hourly(random.choice([True, False]))
        ra.save()

    return itertools.chain(
        [r1, r2],
        Account.objects.all(),
        Project.objects.all(),
        SemesterConfig.objects.all(),
        RAAppointment.objects.all(),
        TAPosting.objects.all(),
        CourseDescription.objects.all(),
        TAApplication.objects.all(),
        CoursePreference.objects.all(),
        TAContract.objects.all(),
        TACourse.objects.all(),
    )
github sfu-fas / coursys / coredata / data_migration / cortez_fix_tastatus.py View on Github external
Argument order must be the same as query in get_tas below.
        """
        if bu == 0:
            return
        if not(emplid.isdigit() and len(emplid)==9):
            # there's only one, from 2004. Ignore.
            return
        if off_id not in self.offeringid_map:
            # Where did these offerings go? I'm troubled.
            print "missing offering_id:", off_id
            return
        offering = self.offeringid_map[off_id]
        p = get_person(emplid, commit=True)
        
        posting = TAPosting.objects.get(unit=self.UNIT, semester=offering.semester)
        
        # create TAApplication
        apps = TAApplication.objects.filter(posting=posting, person=p)
        app = apps[0]
        
        # create TAContract
        contracts = TAContract.objects.filter(posting=posting, application=app)
        contract = contracts[0]

        # distinct values are ['waitlist', 'accepted', None]; most are None
        contract.status = 'CAN' if status=='waitlist' else 'SGN'
        contract.save()
github sfu-fas / coursys / coredata / data_migration / cortez_import.py View on Github external
Argument order must be the same as query in get_tas below.
        """
        if bu == 0:
            return
        if not(emplid.isdigit() and len(emplid)==9):
            # there's only one, from 2004. Ignore.
            return
        if off_id not in self.offeringid_map:
            # Where did these offerings go? I'm troubled.
            print "missing offering_id:", off_id
            return
        offering = self.offeringid_map[off_id]
        p = get_person(emplid, commit=True)
        
        try:
            posting = TAPosting.objects.get(unit=self.UNIT, semester=offering.semester)
        except TAPosting.DoesNotExist:
            posting = self.create_fake_posting(offering.semester)
        
        # create TAApplication
        apps = TAApplication.objects.filter(posting=posting, person=p)
        if apps:
            app = apps[0]
        else:
            app = TAApplication(posting=posting, person=p)
        
        app.category = self.CATEGORY_MAP[cat]
        app.base_units = app_bu or 0
        app.sin = sin
        app.save()
        
        # create TAContract
github sfu-fas / coursys / coredata / devdata_importer.py View on Github external
UserConfig.objects.all(),
            #SemesterPlan.objects.all(),
            #PlannedOffering.objects.all(),
            #PlanningCourse.objects.all(),
            #TeachingEquivalent.objects.all(),
            #TeachingIntention.objects.all(),
            #TeachingCapability.objects.all(),
            FormGroup.objects.all(),
            FormGroupMember.objects.all(),
            Form.objects.all(),
            Sheet.objects.all(),
            Field.objects.all(),
            FormSubmission.objects.all(),
            SheetSubmission.objects.all(),
            FieldSubmission.objects.all(),
            TAPosting.objects.all(),
            TAApplication.objects.all(),
            CoursePreference.objects.all(),
            CourseDescription.objects.all(),
            TAContract.objects.all(),
            TACourse.objects.all(),
            RAAppointment.objects.all(),
            Project.objects.all(),
            SemesterConfig.objects.all(),
            )
    
    data = serializers.serialize("json", objs, sort_keys=True, indent=1)
    fh = open(filename, "w")
    fh.write(data)
    fh.close()