Django

Code

Ticket #5295: joins_order_by.diff

File joins_order_by.diff, 0.8 kB (added by Peter Klein <petkle@gmail.com>, 10 months ago)

accepts db_name as alias

  • query.py

    old new  
    544544                    order = "ASC" 
    545545                if "." in col_name: 
    546546                    table_prefix, col_name = col_name.split('.', 1) 
     547                    # accept table name not only the internal alias as prefix 
     548                    if joins:   
     549                        for join_alias, join_vals in joins.items(): 
     550                            if qn(table_prefix) == join_vals[0]: 
     551                                table_prefix = join_alias 
    547552                    table_prefix = qn(table_prefix) + '.' 
    548553                else: 
    549554                    # Use the database table as a column prefix if it wasn't given,