I'm use Peewee ORM.
I have a class such as this:
class Sample(PMBaseModel):
id = peewee.PrimaryKeyField()
location = peewee.CharField(max_length=255)
position = peewee.IntegerField()
class Meta:
db_table = 'sample'
how i can use Meta Class
for set default ordering and define Order type?
i found answer, with thanks of @giaosudau.
class Sample(PMBaseModel):
id = peewee.PrimaryKeyField()
location = peewee.CharField(max_length=255)
position = peewee.IntegerField()
class Meta:
db_table = 'sample'
order_by = ['-location']
if use '-' in the first of field name in order_by
section, peewee perform DESC ordering of filed.