Hi, I'm trying to make a Manager for my model "order". I want that it returns all orders that their 'active period'* is greater than a certain threshold. With "active period" I mean: (order.cancel_date - order.register_date )
My Order model looks like this: class order(models.Model): register_date = models.DateTimeField(auto_now_add=True) cancel_date = models.DateTimeField(null=True, blank=True) I'm wondering if is possible to achieve that using "annotate", something like that: (this not work) order.objects.annotate(diff=SUB('cancel_date','register_date')).filter(diff__gt=period_threshold) or maybe django provides another kind of tool to achieve what i want ? I'll appreciate any kind of orientation :) thanks!! -- Marc -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.