Given this model, I want to find all ProductSale objects that have expired
and where the Person doesn't have a later (unexpired) purchase of the same
product.

class ProductSale(models.Model):
    product = models.ForeignKey(Product)
    person = models.ForeignKey(Person)
...
    date_expires = models.DateField(blank=True, db_index=True)


The closest I've gotten is in the shell where I get a values_list of person
and product for expired and unexpired and then compare the two lists. That
leaves me with a list of tuples, that (due to the size of the list, I
think) I can't use in a query.extra.

Any suggestions would be appreciated.

(and sorry for the lame subject. I couldn't think of a way to be both
succinct and informative.)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMw3z0TwbHUOLwVKg26N5Bc1q6BQ014hsNVCiws1r083nA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to