How to use the ta.models.TAPosting 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 / ta / tests.py View on Github external
def test_application(self):
        p = Person.objects.get(emplid=210012345)
        s = Semester.objects.get(name="1077")
        unit = Unit.objects.get(label="CMPT")
        d = CourseDescription(unit=unit, description="Lab TA", labtut=True)
        d.save()
        d = CourseDescription(unit=unit, description="Office Hours", labtut=False)
        d.save()

        #Create posting that closes in a long time so no applications are late
        posting = TAPosting(semester=s, unit=unit,opens=date(2007,9,4), closes=date(2099,9,4))
        posting.config['accounts'] = [a.id for a in Account.objects.all()]
        posting.config['start'] = date(2100,10,10)
        posting.config['end'] = date(2101,10,10)
        posting.config['deadline'] = date(2099,9,20)
        posting.save() 

        #Create application for posting as well as campus and course preferences
        app = TAApplication(posting=posting, person=p, category="UTA", base_units=2, sin="123123123", course_load="No Other Courses")
        app.save()

        cp1 = CampusPreference(app=app, campus="BRNBY", pref="PRF")
        cp2 = CampusPreference(app=app, campus="SURRY", pref="NOT")
        cp1.save()
        cp2.save()

        c1 = Course.objects.get(subject="CMPT", number="120")
github sfu-fas / coursys / coredata / data_migration / cortez_import.py View on Github external
"""
        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
        contracts = TAContract.objects.filter(posting=posting, application=app)
github sfu-fas / coursys / coredata / data_migration / cortez_import.py View on Github external
def create_fake_posting(self, sem):
        "Create totally fake posting object: better than throwing away corresponding TAs"
        print "  Faking TAPosting for %s" % (sem)
        posting = TAPosting(unit=self.UNIT, semester=sem)
        posting.opens = sem.start
        posting.closes = sem.start
        posting.config['start'] = sem.start
        posting.config['end'] = sem.end
        posting.config['deadline'] = sem.start
        posting.config['contact'] = self.TA_CONTACT.id
        posting.config['payperiods'] = "%.1f" % (self.total_seconds(sem.end-sem.start)/3600/24/14,) # close enough for the import
        posting.save()
        return posting
github sfu-fas / coursys / coredata / data_migration / cortez_fix_tastatus.py View on Github external
try:
                applic = datetime.datetime.strptime(applic, "%B %d, %Y").date()
            except ValueError:
                applic = start
            try:
                accept = datetime.datetime.strptime(accept, "%B %d, %Y").date()
            except ValueError:
                accept = start

            semester = get_or_create_semester(strm)
            semester.save()
            postings = TAPosting.objects.filter(unit=self.UNIT, semester=semester)
            if postings:
                posting = postings[0]
            else:
                posting = TAPosting(unit=self.UNIT, semester=semester)

            posting.opens = applic
            posting.closes = applic
            posting.config['salary'] = salary
            posting.config['scholarship'] = schol
            posting.config['start'] = start
            posting.config['end'] = end
            posting.config['deadline'] = accept
            posting.config['contact'] = self.TA_CONTACT.id
            posting.config['accounts'] = positions
            posting.config['payperiods'] = "%.1f" % (self.total_seconds(end-start)/3600/24/14,) # close enough for the import
            posting.save()
github sfu-fas / coursys / coredata / data_migration / cortez_fix_tastatus.py View on Github external
def create_fake_posting(self, sem):
        "Create totally fake posting object: better than throwing away corresponding TAs"
        print "  Faking TAPosting for %s" % (sem)
        posting = TAPosting(unit=self.UNIT, semester=sem)
        posting.opens = sem.start
        posting.closes = sem.start
        posting.config['start'] = sem.start
        posting.config['end'] = sem.end
        posting.config['deadline'] = sem.start
        posting.config['contact'] = self.TA_CONTACT.id
        posting.config['payperiods'] = "%.1f" % (self.total_seconds(sem.end-sem.start)/3600/24/14,) # close enough for the import
        posting.save()
        return posting
github sfu-fas / coursys / ta / views.py View on Github external
def new_application_manual(request, post_slug):
    get_object_or_404(TAPosting, slug=post_slug, unit__in=request.units)
    return _new_application(request, post_slug, manual=True)