On Wed, May 27, 2009 at 9:58 AM, mettwoch <mettw...@pt.lu> wrote: > > Thanks Alex, but then I wonder if it would be reasonable to move this > kind of simple rules to a "view" in the database and let Django access > the view rather than the raw table. > > Any experience with that? > > Marc > > On May 27, 4:49 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > > On Wed, May 27, 2009 at 9:45 AM, mettwoch <mettw...@pt.lu> wrote: > > > > > Hi Group, > > > > > I wonder if there's a way to aggregate an expression like: > > > > > Sum("quantity*price") > > > > > on a model having "quantity" and "price" fields. > > > > > Marc > > > > No, there isn't currently a way to do this, besides writing a custom > > aggregate class (search the list for this if you want to do it, it isn't > > that hard and there are several examples). > > > > Alex > > > > -- > > "I disapprove of what you say, but I will defend to the death your right > to > > say it." --Voltaire > > "The people's good is the highest law."--Cicero > > > That works, since you're using a version on the 1.1 path you can use unmanaged models to handle this seemlessly.
http://docs.djangoproject.com/en/dev/ref/models/options/#django.db.models.Options.managed Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---