#NEWLINE# def _get_ordering_condition( self , colname ) : #NEWLINE# #INDENT# ( colname , order_type ) = super ( ModelQuerySet , self ) . _get_ordering_condition ( colname ) #NEWLINE# column = self . model . _columns . get ( colname ) #NEWLINE# if ( column is None ) : #NEWLINE# #INDENT# raise QueryException ( "Can't resolve the column name: '{0}'" . format ( colname ) ) #NEWLINE# #UNINDENT# if ( not column . primary_key ) : #NEWLINE# #INDENT# raise QueryException ( "Can't order on '{0}', can only order on (clustered) primary keys" . format ( colname ) ) #NEWLINE# #UNINDENT# pks = [ v for ( k , v ) in self . model . _columns . items ( ) if v . primary_key ] #NEWLINE# if ( column == pks [ 0 ] ) : #NEWLINE# #INDENT# raise QueryException ( "Can't order by the first primary key (partition key), clustering (secondary) keys only" ) #NEWLINE# #UNINDENT# return ( column . db_field_name , order_type )