Re: Hybrid Property request

2013-07-17 Thread Curtis Maloney
On 17 July 2013 21:18, Jonathan Slenders wrote: > This is really nice. Both have their use cases, but I'm prefering the > second when possible, because it's much more flexible and preserves > database consistency. > With the same efford you can make the following work: > > ProductEntry.objects.fil

Re: Hybrid Property request

2013-07-17 Thread Jonathan Slenders
Oh, and denormalisation is not necessarily faster. If you're able to express the value of the column as an SQL expression, it's possible to put an index on such an expression. Le mercredi 17 juillet 2013 13:18:16 UTC+2, Jonathan Slenders a écrit : > > This is really nice. Both have their use ca

Re: Hybrid Property request

2013-07-17 Thread Jonathan Slenders
This is really nice. Both have their use cases, but I'm prefering the second when possible, because it's much more flexible and preserves database consistency. With the same efford you can make the following work: ProductEntry.objects.filter(lambda p: p.onpurchase_price * p.quantity == 5000.0)

Re: Hybrid Property request

2013-07-16 Thread Alex Gaynor
I'm going to suggest that a virtual field and a materialized field are slightly different concepts, and porblaly have different internals. The former requires some hooks in the ORM, the latter is really just some nice wrapping around existing hooks. In any event there's probably some overal with t

Re: Hybrid Property request

2013-07-16 Thread Jacob Kaplan-Moss
On Tue, Jul 16, 2013 at 8:04 PM, Russell Keith-Magee < russ...@keith-magee.com> wrote: > So - functionally, what you describe can be done. What's missing is > someone to polish the concepts into a patch for inclusion into Django's > repository. If this is something that interests you - get hacking

Re: Hybrid Property request

2013-07-16 Thread Russell Keith-Magee
On Wed, Jul 17, 2013 at 4:02 AM, Luis Francisco Jesus Masuelli Bonanni < endless.l...@gmail.com> wrote: > A feature I would really appreciate (as devs in > http://stackoverflow.com/questions/12217763/does-django-orm-have-an-equivalent-to-sqlalchemys-hybrid-attribute, > at least) is the Hybrid Prop

Hybrid Property request

2013-07-16 Thread Luis Francisco Jesus Masuelli Bonanni
A feature I would really appreciate (as devs in http://stackoverflow.com/questions/12217763/does-django-orm-have-an-equivalent-to-sqlalchemys-hybrid-attribute, at least) is the Hybrid Property feature present in SQLAlchemy. They would really contribute to DRY principle. In django this would al