/srv/irclogs.ubuntu.com/2011/11/30/#ubuntu-app-devel.txt

noodles775lukasz: reading https://docs.djangoproject.com/en/dev/topics/db/queries/#spanning-multi-valued-relationships11:03
noodles775What would you expect Blog.objects.exclude(entry__headline__contains='Lennon', entry__pub_date__year=2008) to do, and why?11:03
lukasznoodles775: exclude blog objects which have associated entry (headline~='Lenon' & year(pub_date)=2008)11:08
noodles775lukasz: that's what I would expect too, but this django test fails http://paste.ubuntu.com/754721/11:09
lukasznoodles775: as ',' in exclude is (should be) translated to AND11:09
noodles775with11:09
noodles775http://paste.ubuntu.com/754723/11:10
noodles775If you agree, I'll submit a django ticket.11:11
lukasznoodles775: that's the last assert in test?11:13
noodles775lukasz: yep - it's the same problem that danny was seeing in his branch when trying my suggested query.11:14
lukasznoodles775: I think it works as expected, as you have: SELECT ... WHERE NOT ((article.headline = 'Article_ with underscore) AND (article.pub_date < '2006-01-01'))11:16
noodles775lukasz: the SQL is doing that, yes, but that wasn't what you expected above was it? (or what did I miss?)11:17
lukaszor am I confused :/11:17
lukasznoodles775: but then, how would you write SQL for the expected behaviour?11:18
noodles775lukasz: Not sure I would, but I wouldn't advertise it as doing the expected behaviour.11:19
lukasznoodles775: maybe submit a ticket and see what django devs think about it11:23
noodles775lukasz: yeah, doing so now.11:23
lukaszalthough changing that behaviour would be a big, incompatible change11:24
noodles775updating the documentation would work.11:24
lukaszah, right11:24
* noodles775 checks the query for the filter too11:25
lukasz.exclude(a, b) == .filter(Q(~Q(a) | ~Q(b)))11:25
noodles775This is the exclude query (formatted): http://paste.ubuntu.com/754738/11:26
lukaszLIMIT 21?11:28
noodles775No idea whyh the limit is 2111:28
noodles775Filter and exclude together: http://paste.ubuntu.com/754742/11:30
lukaszok, that's interesting11:35
noodles775Yeah, the exclude is "Show me all authors who have not published an article with underscore and have not published an article before 2006", which is [], but not what was intended, I think.11:37
noodles775lukasz: I botched the formatting, but here's the bug fwiw: https://code.djangoproject.com/ticket/1731511:57
ubot2Django bug 17315 in Database layer (models, ORM) ".exclude(a, b) does not operate on a single related record" [Normal,New]11:57
jmlhttps://code.launchpad.net/~jml/pkgme-service/end-to-end-pkgme/+merge/83624 finally ready for review12:21
jmlCan I get a review of that branch please?16:24
jmlhttps://code.launchpad.net/~jml/pkgme-service/end-to-end-pkgme/+merge/8362416:24
noodles775jml: if it's not done when you start tomorrow, ping me and I'd be happy to go through it with you.16:27
jmlnoodles775: thanks.16:43

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!