How to chain filters with multi-value realtions?

2008-10-29 Thread Peter Krantz
Hi! I am new to Django and just discovered an issue when trying to filter querysets with multi-value relations. Let's say I have a Article and Tag model where an Article can have many Tags. I have a use case where a bunch of get parameters filters the list of articles based on Article model fiel

Ordering object collection by computed field?

2008-10-12 Thread Peter Krantz
Hi! I have a model like this: class Thing(models.Model): x = models.PositiveIntegerField() y = models.PositiveIntegerField() def z(self): return self.x / self.y * A_CONSTANT In a view I would like to retrieve a collection of Things ordered by z (the computed field). I expected