@@ -1071,7 +1071,7 @@ def test_feedback_closed(self):
10711071 self .assertTrue ( q ('#nominees a' ) )
10721072 self .assertFalse ( q ('#nominees a[href]' ) )
10731073
1074- url += "?nominee=%d&position=%d" % (self .nc .nominee_set .first ().id , self .nc .nominee_set .first ().nomineeposition_set .first ().position .id )
1074+ url += "?nominee=%d&position=%d" % (self .nc .nominee_set .order_by ( 'pk' ). first ().id , self .nc .nominee_set .order_by ( 'pk' ). first ().nomineeposition_set . order_by ( 'pk' ) .first ().position .id )
10751075 response = self .client .get (url )
10761076 self .assertEqual (response .status_code , 200 )
10771077 q = PyQuery (response .content )
@@ -1102,7 +1102,7 @@ def test_nominations_closed(self):
11021102
11031103 def test_acceptance_closed (self ):
11041104 today = datetime .date .today ().strftime ('%Y%m%d' )
1105- pid = self .nc .position_set .first ().nomineeposition_set .first ().id
1105+ pid = self .nc .position_set .first ().nomineeposition_set .order_by ( 'pk' ). first ().id
11061106 url = reverse ('nomcom_process_nomination_status' , kwargs = {
11071107 'year' : self .nc .year (),
11081108 'nominee_position_id' : pid ,
@@ -1247,7 +1247,7 @@ def setUp(self):
12471247 self .nc = NomComFactory .create (** nomcom_kwargs_for_year ())
12481248 self .author = PersonFactory .create ().email_set .first ().address
12491249 self .member = self .nc .group .role_set .filter (name = 'member' ).first ().person
1250- self .nominee = self .nc .nominee_set .first ()
1250+ self .nominee = self .nc .nominee_set .order_by ( 'pk' ). first ()
12511251 self .position = self .nc .position_set .first ()
12521252 for type_id in ['comment' ,'nomina' ,'questio' ]:
12531253 f = FeedbackFactory .create (author = self .author ,nomcom = self .nc ,type_id = type_id )
@@ -1331,7 +1331,7 @@ def test_help(self):
13311331
13321332 def test_accept_reject_nomination_edges (self ):
13331333
1334- np = self .nc .nominee_set .first ().nomineeposition_set .first ()
1334+ np = self .nc .nominee_set .order_by ( 'pk' ). first ().nomineeposition_set . order_by ( 'pk' ) .first ()
13351335
13361336 kwargs = {'year' :self .nc .year (),
13371337 'nominee_position_id' :np .id ,
@@ -1361,7 +1361,7 @@ def test_accept_reject_nomination_edges(self):
13611361 self .assertTrue ('Bad hash!' in unicontent (response ))
13621362
13631363 def test_accept_reject_nomination_comment (self ):
1364- np = self .nc .nominee_set .first ().nomineeposition_set .first ()
1364+ np = self .nc .nominee_set .order_by ( 'pk' ). first ().nomineeposition_set . order_by ( 'pk' ) .first ()
13651365 hash = get_hash_nominee_position (np .time .strftime ("%Y%m%d" ),np .id )
13661366 url = reverse ('nomcom_process_nomination_status' ,
13671367 kwargs = {'year' :self .nc .year (),
@@ -1453,7 +1453,7 @@ def test_simple_feedback_pending(self):
14531453 self .assertEqual (np .nominee .feedback_set .count (),fb_count_before + 1 )
14541454
14551455 fb = FeedbackFactory (nomcom = self .nc ,type_id = None )
1456- nominee = self .nc .nominee_set .first ()
1456+ nominee = self .nc .nominee_set .order_by ( 'pk' ). first ()
14571457 position = self .nc .position_set .exclude (nomineeposition__nominee = nominee ).first ()
14581458 self .assertIsNotNone (position )
14591459 fb_count_before = nominee .feedback_set .count ()
@@ -1539,7 +1539,7 @@ def test_complicated_feedback_pending(self):
15391539 fb0 = FeedbackFactory (nomcom = self .nc ,type_id = None )
15401540 fb1 = FeedbackFactory (nomcom = self .nc ,type_id = None )
15411541 fb2 = FeedbackFactory (nomcom = self .nc ,type_id = None )
1542- nominee = self .nc .nominee_set .first ()
1542+ nominee = self .nc .nominee_set .order_by ( 'pk' ). first ()
15431543 new_position_for_nominee = self .nc .position_set .exclude (nomineeposition__nominee = nominee ).first ()
15441544
15451545 # Initial formset
@@ -1679,15 +1679,15 @@ def test_edit_invalid_position(self):
16791679 self .assertEqual (response .status_code , 404 )
16801680
16811681 def test_edit_nominee (self ):
1682- nominee = self .nc .nominee_set .first ()
1682+ nominee = self .nc .nominee_set .order_by ( 'pk' ). first ()
16831683 new_email = EmailFactory (person = nominee .person )
16841684 url = reverse ('nomcom_edit_nominee' ,kwargs = {'year' :self .nc .year (),'nominee_id' :nominee .id })
16851685 login_testing_unauthorized (self ,self .chair .user .username ,url )
16861686 response = self .client .get (url )
16871687 self .assertEqual (response .status_code , 200 )
16881688 response = self .client .post (url ,{'nominee_email' :new_email .address })
16891689 self .assertEqual (response .status_code , 302 )
1690- nominee = self .nc .nominee_set .first ()
1690+ nominee = self .nc .nominee_set .order_by ( 'pk' ). first ()
16911691 self .assertEqual (nominee .email ,new_email )
16921692
16931693 def test_request_merge (self ):
0 commit comments