Did you read this message? Do you think it's correct? > Is the code that it's wrong, for me. > > qty_discounts = product.price_set.exclude(expires__isnull=False, > expires__lt=datetime.date.today()).filter(quantity__lte=qty) > > filters out prices that have expires NOT NULL AND have expires before > today, which gets all correct prices but doesn't order them. > > to do what we want I think it should be ordered like that: > > val = qty_discounts.order_by('-quantity').order_by('expires')[0].dynamic_price > > instead of current > > val = qty_discounts.order_by('-quantity')[0].dynamic_price > > don't you think?
-- Alessandro Ronchi Skype: aronchi http://www.alessandroronchi.net SOASI Soc.Coop. - www.soasi.com Sviluppo Software e Sistemi Open Source Sede: Via Poggiali 2/bis, 47100 Forlì (FC) Tel.: +39 0543 798985 - Fax: +39 0543 579928 Rispetta l'ambiente: se non ti è necessario, non stampare questa mail --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Satchmo users" group. To post to this group, send email to satchmo-users@googlegroups.com To unsubscribe from this group, send email to satchmo-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en -~----------~----~----~----~------~----~------~--~---