[PonyORM-list] global name 'desc' is not defined

Guy Jacks guy.jacks at gmail.com
Tue Dec 17 17:15:32 UTC 2013


That worked.  Thank you.


On Tue, Dec 17, 2013 at 12:08 PM, Alexey Malashkevich <
alexeymalashkevich at gmail.com> wrote:

> Looks like you didn't import the desc() function. You can import it either
> this way:
>
>     from pony.orm import *
>
> or this way:
>
>     from pony.orm import desc
>
> The first way will import all the necessary functions for working with
> Pony ORM, whereas with the second approach you can choose what you import
> and what not. Also, if you don't want to import Pony functions into your
> global name space you can do this:
>
>     from pony import orm
>
> In this case you can access the desc() function via the orm module:
>
>     transactions = Transaction.select().order_by(orm.
> desc(Transaction.created))[:]
>
> Let me know if it worked for you.
> Thanks,
> Alexey
>
>
> On Tue, Dec 17, 2013 at 8:34 PM, Guy Jacks <guy.jacks at gmail.com> wrote:
>
>> transactions = Transaction.select().order_by(desc(Transaction.created))[:]
>>
>> This works without the desc() method but it fails after I wrap
>> Transaction.created in desc().
>>
>> The documentation states that the following should work:
>>
>> for p in Product.select(lambda p: p.price >
>> 100).order_by(desc(Product.price))
>>
>> Thanks in advance for any pointers.
>>
>> _______________________________________________
>> ponyorm-list mailing list
>> ponyorm-list at ponyorm.com
>> /ponyorm-list
>>
>>
>
> _______________________________________________
> ponyorm-list mailing list
> ponyorm-list at ponyorm.com
> /ponyorm-list
>
>


-- 
Internet Strategist and Applications Architect

mobile: 614.448.7649
guy.jacks at gmail.com
gtalk: guy.jacks
skype: guy.jacks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </ponyorm-list/attachments/20131217/0890ef52/attachment.html>


More information about the ponyorm-list mailing list