Ejemplo n.º 1
0
    def new_assignment(**kwargs):
        test_committee = kwargs.pop("committee", None) or TestCommittees.new_committee()
        test_school = kwargs.pop("school", None) or TestSchools.new_school()
        test_country = kwargs.pop("country", None) or TestCountries.new_country()

        a = Assignment(
            committee=test_committee, school=test_school, country=test_country, rejected=kwargs.pop("rejected", False)
        )
        a.save()
        return a
Ejemplo n.º 2
0
    def new_assignment(**kwargs):
        test_committee = TestCommittees.new_committee()
        test_school = TestSchools.new_school()
        test_country = TestCountries.new_country()

        a = Assignment(committee=kwargs.pop('committee', test_committee),
                       school=kwargs.pop('school', test_school),
                       country=kwargs.pop('country', test_country),
                       rejected=kwargs.pop('rejected', False))
        a.save()
        return a
Ejemplo n.º 3
0
def new_assignment(**kwargs):
    test_committee = kwargs.pop('committee', None) or new_committee()
    test_school = kwargs.pop('school', None) or new_school()
    test_country = kwargs.pop('country', None) or new_country()

    a = Assignment(
        committee=test_committee,
        school=test_school,
        country=test_country,
        rejected=kwargs.pop('rejected', False),)
    a.save()
    return a
Ejemplo n.º 4
0
    def new_assignment(**kwargs):
        test_committee = TestCommittees.new_committee()
        test_school = TestSchools.new_school()
        test_country = TestCountries.new_country()

        a = Assignment(
                committee=kwargs.pop('committee', test_committee),
                school=kwargs.pop('school', test_school),
                country=kwargs.pop('country', test_country),
                rejected=kwargs.pop('rejected', False))
        a.save()
        return a
Ejemplo n.º 5
0
def new_assignment(**kwargs):
    test_committee = kwargs.pop('committee', None) or new_committee()
    test_registration = kwargs.pop('registration', None) or new_registration()
    test_country = kwargs.pop('country', None) or new_country()

    a = Assignment(
        committee=test_committee,
        registration=test_registration,
        country=test_country,
        rejected=kwargs.pop('rejected', False),
    )
    a.save()
    return a
Ejemplo n.º 6
0
def new_assignment(**kwargs):
    test_committee = kwargs.pop('committee', None) or new_committee()
    test_school = kwargs.pop('school', None) or new_school()
    test_country = kwargs.pop('country', None) or new_country()

    a = Assignment(
        committee=test_committee,
        school=test_school,
        country=test_country,
        rejected=kwargs.pop('rejected', False),
    )
    a.save()
    return a
Ejemplo n.º 7
0
def new_assignment(**kwargs):
    test_committee = kwargs.pop('committee', None) or new_committee()
    test_registration = kwargs.pop('registration', None) or new_registration()
    test_country = kwargs.pop('country', None) or new_country()
    test_paper = kwargs.pop('paper', None)

    a = Assignment(
        committee=test_committee,
        registration=test_registration,
        country=test_country,
        paper=test_paper,
        rejected=kwargs.pop('rejected', False), )
    a.save()
    return a
Ejemplo n.º 8
0
 def test_create_position_paper(self):
     '''Tests that an assigment creates a new position paper upon
        being saved for the first time, but not on subsequent saves.'''
     a = Assignment(committee_id=1, country_id=1, registration_id=1)
     self.assertTrue(a.paper == None)
     a.save()
     self.assertTrue(a.paper != None)
     paper_id = a.paper.id
     a.paper.graded = True
     a.paper.save()
     a.save()
     self.assertTrue(a.paper.graded)
     self.assertEquals(a.paper.id, paper_id)
     a.paper = None
     a.save()
     self.assertFalse(a.paper == None)
     self.assertFalse(a.paper.id == paper_id)
Ejemplo n.º 9
0
 def test_create_position_paper(self):
     '''Tests that an assigment creates a new position paper upon
        being saved for the first time, but not on subsequent saves.'''
     a = Assignment(committee_id=1, country_id=1, registration_id=1)
     self.assertTrue(a.paper == None)
     a.save()
     self.assertTrue(a.paper != None)
     paper_id = a.paper.id
     a.paper.graded = True
     a.paper.save()
     a.save()
     self.assertTrue(a.paper.graded)
     self.assertEquals(a.paper.id, paper_id)
     a.paper = None
     a.save()
     self.assertFalse(a.paper == None)
     self.assertFalse(a.paper.id == paper_id)
Ejemplo n.º 10
0
sys.path.append(abspath(dirname(dirname(__file__))))
os.environ['DJANGO_SETTINGS_MODULE'] = 'huxley.settings'

from huxley.core.models import Country, Committee, Assignment
from xlrd import open_workbook

s = open_workbook('Country Matrix.xlsx').sheet_by_index(0)

country_range = s.nrows-2
committee_range = 22

for row in range(3, country_range):
	Country.objects.get_or_create(name=s.cell(row, 0).value, special=(True if row > 204 else False))

for col in range(1, committee_range):
	Committee.objects.get_or_create(name=s.cell(1, col).value, full_name=s.cell(2, col).value, delegation_size=(1 if s.cell(0, col).value == 'SINGLE' else 2), special=(True if col > 7 else False))

for row in range(3, country_range):
	for col in range(1, committee_range):
		if s.cell(row, col).value:
			print s.cell(1, col).value
			print s.cell(2, col).value
			print s.cell(row, 0).value
			print s.cell(row,col).value
			print
			country = Country.objects.get(name=s.cell(row, 0).value)
			committee = Committee.objects.get(name=s.cell(1, col).value)
			assignment = Assignment(committee=committee, country=country)
			assignment.save()

Ejemplo n.º 11
0
from xlrd import open_workbook

s = open_workbook('Country Matrix.xlsx').sheet_by_index(0)

country_range = s.nrows - 2
committee_range = 22

for row in range(3, country_range):
    Country.objects.get_or_create(name=s.cell(row, 0).value,
                                  special=(True if row > 204 else False))

for col in range(1, committee_range):
    Committee.objects.get_or_create(
        name=s.cell(1, col).value,
        full_name=s.cell(2, col).value,
        delegation_size=(1 if s.cell(0, col).value == 'SINGLE' else 2),
        special=(True if col > 7 else False))

for row in range(3, country_range):
    for col in range(1, committee_range):
        if s.cell(row, col).value:
            print s.cell(1, col).value
            print s.cell(2, col).value
            print s.cell(row, 0).value
            print s.cell(row, col).value
            print
            country = Country.objects.get(name=s.cell(row, 0).value)
            committee = Committee.objects.get(name=s.cell(1, col).value)
            assignment = Assignment(committee=committee, country=country)
            assignment.save()