I have the following piece of code:

class ContributieNotas(object):

    class Admin(EntityAdmin):
        verbose_name = 'Contributie notas'
        verbose_name_plural = 'Contributienota\'s'
        list_display = ['id', 'achternaam', 'tussenvoegsel',
'voorletters', 'adres',
                            'postcode', 'woonplaats','omschrijving',
'tariefbedrag', 'adresenpc']

def setup_views():

    q = select([model.Leden.id, model.Leden.achternaam,
model.Leden.tussenvoegsel, model.Leden.voorletters,
                    model.Leden.adres, model.Leden.postcode,
model.Leden.woonplaats, model.Tarieven.omschrijving,
                    model.Tarieven.tariefbedrag,
model.Leden.adresenpc],
                    whereclause =
and_(model.Leden.lidsoort_id.in_([1,2]),
                    model.Tarieven.id == model.Leden.lidsoort_id),
                    order_by = (model.Leden.achternaam))

    q = q.alias('contributie_alle_leden')

    mapper(ContributieNotas, q)

It's part of software I'm developing with the Camelot framework. The
results of the query are put in a Camelot list_display. That works OK,
except for the fact that the results are in order of the primary key
of the Leden table and not in the order of achternaam (= family name).
Omitting the primary key field (Leden.id) leads to complaints of
Sqlalchemy about missing primary keys. I tried some other solutions,
one of them is putting the order by clause in the mapper but without
result. So it seems that the order by is neglected. What am I doing
wrong?

Peter

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to