Re: [Django] #16211: using negated F()-expression in update query

2023-02-13 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  Walter Doekes|Owner:  David
 |  Wobrock
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Andreas Galazis):

 Just a quick update on this you can always use excludes to negate
 filters(not annotation) in versions before this fix and I think it's even
 better since as far as I can see the new negated expression uses case
 statement instead of negation. I one thing I would like to see, is the new
 negation expression without case statement.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701864a393488-b72a3c2a-2832-4161-9656-ce691b8b625e-00%40eu-central-1.amazonses.com.


Re: [Django] #16211: using negated F()-expression in update query

2022-10-31 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  Walter Doekes|Owner:  David
 |  Wobrock
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 Fixed in a320aab5129f4019b3c1d28b7a3b509582bc56f9.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701842dd308ff-30044e3b-a297-4cdc-b8b4-80a71862ff46-00%40eu-central-1.amazonses.com.


Re: [Django] #16211: using negated F()-expression in update query

2022-10-31 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  Walter Doekes|Owner:  David
 |  Wobrock
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * needs_better_patch:  1 => 0
 * stage:  Accepted => Ready for checkin


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701842d2de7d1-32284ae4-5e53-47b0-bf5a-a664eb3f75fa-00%40eu-central-1.amazonses.com.


Re: [Django] #16211: using negated F()-expression in update query

2022-10-27 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  Walter Doekes|Owner:  David
 |  Wobrock
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * needs_better_patch:  0 => 1


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018418b9d2b2-bc6b8b16-d0f5-4762-a62f-6454288ff823-00%40eu-central-1.amazonses.com.


Re: [Django] #16211: using negated F()-expression in update query

2022-10-08 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  Walter Doekes|Owner:  David
 |  Wobrock
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by David Wobrock):

 * needs_docs:  1 => 0
 * needs_tests:  1 => 0


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183b8c0681f-7721f9cd-95a9-48cb-a245-1d24f915a0c3-00%40eu-central-1.amazonses.com.


Re: [Django] #16211: using negated F()-expression in update query

2022-10-04 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  Walter Doekes|Owner:  David
 |  Wobrock
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  1|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * needs_docs:  0 => 1
 * needs_tests:  0 => 1


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183a2b783e5-66459d8f-99f0-449d-a8f4-d944d71b357e-00%40eu-central-1.amazonses.com.


Re: [Django] #16211: using negated F()-expression in update query

2022-09-29 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  Walter Doekes|Owner:  David
 |  Wobrock
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by David Wobrock):

 * needs_better_patch:  1 => 0
 * needs_tests:  1 => 0


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701838a9ef6a0-0f1942ad-55de-4acd-9ba5-fa8d885158b8-00%40eu-central-1.amazonses.com.


Re: [Django] #16211: using negated F()-expression in update query

2022-09-26 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  Walter Doekes|Owner:  David
 |  Wobrock
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by David Wobrock):

 * owner:  nobody => David Wobrock
 * needs_better_patch:  0 => 1
 * has_patch:  0 => 1
 * status:  new => assigned
 * needs_tests:  0 => 1


Comment:

 Started working on a patch: [https://github.com/django/django/pull/16121
 PR]

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701837ba924e0-78f22d79-17c8-43f1-a7e7-f37fa85bf2f3-00%40eu-central-1.amazonses.com.


Re: [Django] #16211: using negated F()-expression in update query

2022-09-13 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  Walter Doekes|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by David Wobrock):

 * cc: David Wobrock (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183363baee4-e1100f0e-710f-46f4-a867-67c7926687c5-00%40eu-central-1.amazonses.com.


Re: [Django] #16211: using negated F()-expression in update query

2022-08-15 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  Walter Doekes|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 If anyone is interested in implementing this feature now that the
 landscape has change quite a bit with the introduction of `Expression` I'd
 suggest doing the following.

 - Introduce a `NegatedExpression(ExpressionWrapper)` class that
 `Combinable.__invert__(self)` returns as `NegatedExpression(self)`
 - `NegatedExpression.as_sql` should return `sql = "NOT
 {super().as_sql(...)}`
 - `NegatedExpression.__invert__` should return `self.expression`
 - `NegatedExpression.output_field` should be `BooleanField`
 - Possibly have `Expression.__invert__` error out `if not
 self.conditional`?
 - Remove the custom `Exists.__invert__`
 - Add tests for the whole thing

 All the other usage cases mentioned in this ticket seem to already be
 covered by `Combinable` additions in the past years.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070182a4780a8d-84b78cc9-5b4f-410e-b0be-760601bc35ba-00%40eu-central-1.amazonses.com.


Re: [Django] #16211: using negated F()-expression in update query

2012-11-28 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  0
Has patch:  0|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by akaariai):

 If anybody is willing to do a PR (or just attach a patch) we could now add
 the new behaviour to master.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-16 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  0
Has patch:  0|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by twoolie):

 SQLServer does not have a BOOLEAN datatype. The closest analogue is the
 bit field. (http://stackoverflow.com/a/1777277/234254).

 This means we probably need something like
 `UPDATE [expressions_company] SET [is_large] =
 ~([expressions_company].[num_employees] < ?)` to do a bitwise not for
 MSSQL.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-11 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  0
Has patch:  0|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by akaariai):

 Interesting. To me it seems this should be standard SQL. Does adding more
 parentheses affect this at all? Is there some other way to write the
 equivalent query in MSSQL?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-11 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  0
Has patch:  0|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by manfre):

 For future reference, not all databases (mssql) support the requested
 behavior.

 The usage of `NOT` in the reverted commit
 28abf5f0ebc9d380f25dd278d7ef4642c4504545, `UPDATE [expressions_company]
 SET [is_large] = NOT (([expressions_company].[num_employees] < ?))`, is
 not valid for MSSQL. "Incorrect syntax near the keyword 'NOT'".

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-09 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  0
Has patch:  0|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by Anssi Kääriäinen ):

 In [changeset:"041ef9ed68722fa5f8c38c9e39fad67714f35014"]:
 {{{
 #!CommitTicketReference repository=""
 revision="041ef9ed68722fa5f8c38c9e39fad67714f35014"
 Removed some uses of F() expression & and |

 Refs #16211
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-09 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  0
Has patch:  0|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by akaariai):

 * status:  closed => reopened
 * resolution:  fixed =>
 * severity:  Release blocker => Normal
 * stage:  Ready for checkin => Accepted


Comment:

 The commits above were reverts, so reopening...

 The current status is that once 1.5 branch is created we can reapply the
 reverted patches (with minor modifications, of course).

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-09 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:  fixed
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Anssi Kääriäinen ):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"a8b1861fc4d0a48b4879af803bba094eef145017"]:
 {{{
 #!CommitTicketReference repository=""
 revision="a8b1861fc4d0a48b4879af803bba094eef145017"
 Revert "Fixed #16211 -- Added comparison and negation ops to F()
 expressions"

 This reverts commit 28abf5f0ebc9d380f25dd278d7ef4642c4504545.

 Conflicts:

 docs/releases/1.5.txt
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-09 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:  fixed
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Anssi Kääriäinen ):

 In [changeset:"b625e8272bd41714c838cfda3fb54e1f5177f009"]:
 {{{
 #!CommitTicketReference repository=""
 revision="b625e8272bd41714c838cfda3fb54e1f5177f009"
 Moved F() '&' and '|' to .bitand() and .bitor()

 Done for consistency with Q() expressions and QuerySet combining. This
 will allow usage of '&' and '|' as boolean logical operators in the
 future. Refs #16211.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-09 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by akaariai):

 Yeah, it is a little bit ugly that we need to use the bitwise operators
 for their boolean meaning. But, that seems the only way forward if we want
 to support boolean operators for F() expressions. And, it seems we want
 that, this will allow using .update() in new situations with little added
 code.

 Even if we wouldn't want boolean operators for F() expressions it is
 questionable if using '&' for different meaning in Q() and F() expressions
 is a good API.

 I believe the users of '&' and '|' in their bitwise meaning are extremely
 rare, so this shouldn't be a big issue for most users.

 I will commit the removal of '&' and '|' soon.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-08 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by twoolie):

 @wdokes: Pep-335 looked like it would be revived end of last year when
 they were working on PY3. You must admit that it would be very handy to
 have exactly for situations such as this.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-05 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by wdoekes):

 @twoolie: not entirely.

 `||` is actually the concatenation operator in SQL. In MySQL it works
 (unless you run sql_mode = 'ANSI'), but in others it doesn't.

 postgres:
 {{{
 => select 'abc' || 'def';
 abcdef
 => select (1 < 2) && (2 > 1);
 ERROR:  operator does not exist: boolean && boolean
 }}}

 AND and OR should work in all:
 {{{
 => select (1 < 2) and (2 > 1);
 t
 => select (1 < 2) or (2 > 200);
 t
 }}}


 @twoolie: championing a rejected PEP?


 @akaariai: pull 419 looks ok to me.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-04 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by twoolie):

 So if we want &/| to work in the same way for Q and F objects then this
 should be the goal?

 {{{
 SQL  | ORM
 -+
 field1 &  field2 | F('field1').bitand(F('field2'))
 field1 && field2 | F('field1') & F('field2')
 field1 |  field2 | F('field1').bitor(F('field2'))
 field1 || field2 | F('field1') | F('field2')
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-03 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by akaariai):

 See pull https://github.com/django/django/pull/419 for suggested changes.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-02 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by claudep):

 I'm +1 with Anssi's plan, I think this is in agreement with the
 conservative Django stability policy.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-02 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by wdoekes):

 Well.. that would only be in 1.5. I would argue that you also wouldn't
 know what it does without looking at the Django version ;)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-02 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by akaariai):

 I am not a fan of that approach. This means that when you see
 {{{
 F('something')('something_else')
 }}}
 you don't actually know what the code is doing without looking at the
 settings.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-02 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by wdoekes):

 I wholeheartedly agree that a loud error is preferred over unsafe
 behaviour changes.

 I don't know if there is a precedent for this, but perhaps a temporary
 SETTING is possible? Have it error loudly, but you can get the future
 boolean operators enabled. Otherwise you'll have to change your code twice
 if you meant to have boolean logic.

 {{{
 if not getattr(settings, 'FUTURE_DJANGO16_F_EXPRESSION_BOOLEAN_AND_OR'):
 raise LoudError(("Use FUTURE_DJANGO16_F_EXPRESSION_BOOLEAN_AND_OR if
 you're not using "
  "the bitwise capabilities; otherwise use
 .bitand/.bitor."))
 else:
 # proceed as before
 pass
 }}}

 This would enable the majority of users to simply hit a switch.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-01 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by akaariai):

 Here is my idea how to move this issue forward:
   - Revert the commit
   - Remove '&' and '|' operators from 1.5, implement F.bitand() and
 F.bitor() instead
   - Reintroduce this feature into 1.6

 The idea is that in 1.5 usage of '&' and '|' will fail loudly. If we just
 replace what '&' and '|' do then there is possibility that the operators
 still work for upgraders, but they just don't do what they did in 1.4.
 This is a data-loss issue.

 In 1.6 we would have then boolean operators for F(), and '&' and '|' would
 work like they do for Q-objects.

 The '&' and '|' operators aren't documented, or at least I can't find any
 reference to them. The question is if anybody is actually using them. If
 not, then we could just replace the meaning of '&' and '|' directly in
 1.5. But, as said, I vote for the safe alternative of one release where
 you can't use '|' and '&' at all.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-01 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by akaariai):

 The problem is that in 1.4 we already do define '&' and '|' to behave as
 bitwise operators. This is not documented, but the behaviour is there and
 tested. For this feature we need the same '&' and '|' operators to do
 boolean AND and OR operations in the DB. This is a conflict which I don't
 see any nice way to resolve. The best would be to have f1.bitand(f2) and
 f1.bitor(f2). But, if we do this we will be silently breaking existing
 code using the '&' and '|' operators.

 As for `__hash__` - from Python 3 docs:
 {{{
 Called by built-in function hash() and for operations on members of hashed
 collections
 including set, frozenset, and dict. __hash__() should return an integer.
 The only
 required property is that objects which compare equal have the same hash
 value...
 }}}

 The problem is all F-objects compare equal to each other by the `__eq__`
 override, and for that reason we can't implement `__hash__`.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-01 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by twoolie):

 @akaariai: From the
 [http://docs.python.org/reference/datamodel.html#object.__hash__],

 > Called by built-in function hash() and for operations on members of
 hashed collections including set, frozenset, and dict. __hash__() should
 return an integer.
 > User-defined classes have `__cmp__()` and `__hash__()` methods by
 default; with them, all objects compare unequal (except with themselves)
 and `x.__hash__()` returns `id(x)`.

 This means that even when overriding `__eq__()` we are not breaking the
 hashability of F objects, and hence do not break sets or dicts.

 As far as using bitwise operators, we're forced to do it due to
 limitations in python's operator overloading. As far as i'm concerned,
 this is entirely consistent with Q objects and as long as it's explicitly
 documented, it should be fine. Really, the only way we can fix this is to
 make people do `(F('somefield')<100).and(F('somefield') >50)` every time
 they want to do `&&` which will be confusing.

 I volunteer to write extra docs for the new operators if that's required.

 (Random Thoughts) Perhaps what we need is an E object that can take a
 "normalized" (db independent) expression that we can build F objects from.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-01 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by akaariai):

 BTW I can't see the bitwise operators for F() expressions documented
 anywhere. I think we want to document those...

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-10-01 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  reopened
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by akaariai):

 * status:  closed => reopened
 * has_patch:  1 => 0
 * resolution:  fixed =>
 * severity:  Normal => Release blocker


Comment:

 It seems I will have to revert this whole commit. The problem is we define
 '&' and '|' operators as bitwise and / or. But, other operators we define
 as boolean operators. This means (F('somefield') < 100) & (F'somefield') >
 50) doesn't do what one expects, and downright fails on some databases.

 I can see only one solutions apart of just reverting and wontfixing this
 issue: Create a subclass of F which redefines what '&' and '|' mean.

 I will leave this open for a while to see if any ideas pop out. The most
 likely solution is a revert from 1.5. Then we can revisit this issue for
 1.6 and see if we can create something working...

 This is causing a failure in expressions tests at least on postgres.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-09-30 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:  fixed
 Severity:  Normal   | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Anssi Kääriäinen ):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"28abf5f0ebc9d380f25dd278d7ef4642c4504545"]:
 {{{
 #!CommitTicketReference repository=""
 revision="28abf5f0ebc9d380f25dd278d7ef4642c4504545"
 Fixed #16211 -- Added comparison and negation ops to F() expressions

 Work done by Walter Doekes and Trac alias knoeb. Reviewed by Simon
 Charette.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-09-28 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by akaariai):

 I made some changes to the patch, mostly cosmetic changes to tests and
 docs.

 However, there was one real problem shown by Python 3 tests - now that F()
 objects override `__eq__` they are no longer hashable. This means they are
 not usable in sets or as keys in dicts. This can be a problem for users.
 If they are currently using F() expressions in sets, they can no longer do
 so. In addition this change required some refactoring in
 sql/expressions.py which used F() expressions in dicts.

 This patch is giving me an uneasy feeling because of the `__eq__` method.
 Otherwise I think this should be ready for checkin. We do not have the
 option to define other comparison methods except `__eq__`, users will try
 to use == anyways if other comparisons are implemented.

 Tracked in https://github.com/django/django/pull/405

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-09-24 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by twoolie):

 * needs_better_patch:  1 => 0
 * stage:  Accepted => Ready for checkin
 * needs_docs:  1 => 0


Comment:

 charettes: requested changes have been made. Should now be ready for
 checkin.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-08-28 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by charettes):

 * cc: charette.s@… (added)
 * needs_docs:  0 => 1
 * version:  1.4 => master
 * stage:  Ready for checkin => Accepted
 * needs_better_patch:  0 => 1


Comment:

 @koenb, this patch is not RFC. I spotted two things worth fixing:

 1. `ExpressionNode.__nonzero__` should be replaced by `__bool__` and
 `__nonzero__` should alias the latter for python 2.X compatibility.
 2. The version added note in query documentation should be updated to 1.5
 3. A release note should also be added.

 Moving back to ''Accepted''.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-08-24 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.4
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by koenb):

 * stage:  Accepted => Ready for checkin


Comment:

 This looks good to me. I ran the test suite on sqlite and found no
 regressions.

 The patch did not apply perfectly anymore, so I am attaching a new diff.

 I think this is ready for checkin.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-08-24 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.4
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by akaariai):

 Basically, a review by anybody else than patch author is OK. See
 [https://docs.djangoproject.com/en/dev/internals/contributing/triaging-
 tickets/#ready-for-checkin]. A review isn't mandatory, but it will help
 the committer, and thus also help you to get the patch in.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-08-23 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.4
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by anonymous):

 Who would need to review the patch?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-08-22 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.4
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by akaariai):

 * needs_docs:  1 => 0
 * needs_tests:  1 => 0


Comment:

 I discussed this on IRC with Alex, and he said overriding `__eq__` in this
 way is common. I do agree with your point about unexpected results if ==
 is defined differently than the rest of the operators.

 So, I think there aren't any design decision to do in this patch any more.
 If you can get somebody to review the patch, that would be great. If not,
 I will try to find some time to do that myself.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-08-22 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.4
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by anonymous):

 If you have overridden all of the other operators, people will expect the
 `==` and `!=` to work the same. If you specify .eq or .neq, then someone
 is going to write `.update(field = F('predicate') == F('value') )` and it
 will set False every time.

 The best way to tell if it will conflict with internal django comparisons
 is to patch it into trunk and run all the tests. If the tests pass, it's
 all good.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-08-21 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.4
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by akaariai):

 I quickly skimmed the patch and I do think this is useful, and that the
 patch is mostly ready. So, it is likely that this would get merged,
 although there can not be any guarantee.

 My biggest worry is the `__eq__` and `__ne__` methods. I have a feeling
 defining these methods to return another expression could lead to weird
 situations. Basically any f expression always returns True from ==, and
 !=, so if people are using these comparisons (or we happen to use these
 comparisons internally in Django) things will break.

 Maybe the `__eq__` and `__ne__` should be implemented as methods instead,
 so, instead of writing F('foo') == F('bar'), you would write
 F('foo').eq(F('bar')). It is a bit uglier, but should be safe re the above
 issue.

 I don't know too well how Python expects these methods to behave, so it is
 possible that this is an acceptable way to use `__eq__` and `__ne__`.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-08-21 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.4
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by anonymous):

 Looks like it has tests. If docs were written and patch rebased, would it
 get merged?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-08-16 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.4
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by aaugustin):

 For starterts the patch needs documentation and tests.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2012-08-16 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.4
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by anonymous):

 * version:  1.2 => 1.4


Comment:

 Bump. Why is this not merged yet?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #16211: using negated F()-expression in update query

2011-11-17 Thread Django
#16211: using negated F()-expression in update query
-+-
 Reporter:  wdoekes  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.2
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by wdoekes):

 Bump. The patch might be getting a bit stale after 5 months.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16211: using negated F()-expression in update query

2011-06-19 Thread Django
#16211: using negated F()-expression in update query
-+-
   Reporter:  wdoekes|  Owner:  nobody
   Type:  New| Status:  new
  feature|  Component:  Database layer
  Milestone: |  (models, ORM)
Version:  1.2|   Severity:  Normal
 Resolution: |   Keywords:
   Triage Stage:  Accepted   |  Has patch:  1
Needs documentation:  1  |Needs tests:  1
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-

Comment (by wdoekes):

 Added issue16211+14029-query-expression-extra-operators.patch which fixes
 incorrect comments about logical operators when referring to comparisons
 and which addresses the need for a `TypeError` raised in #14029 when
 trying to do boolean operations on F() (by raising on `__nonzero__`).

 Now `not F()` will `raise TypeError('Boolean operators should be avoided.
 Use bitwise operators.')`

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16211: using negated F()-expression in update query

2011-06-18 Thread Django
#16211: using negated F()-expression in update query
-+-
   Reporter:  wdoekes|  Owner:  nobody
   Type:  New| Status:  new
  feature|  Component:  Database layer
  Milestone: |  (models, ORM)
Version:  1.2|   Severity:  Normal
 Resolution: |   Keywords:
   Triage Stage:  Accepted   |  Has patch:  1
Needs documentation:  1  |Needs tests:  1
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-

Comment (by ramiro):

 #14029 had reported this before. I closed it in favor of this one that has
 a patch.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16211: using negated F()-expression in update query

2011-06-18 Thread Django
#16211: using negated F()-expression in update query
-+-
   Reporter:  wdoekes|  Owner:  nobody
   Type:  New| Status:  new
  feature|  Component:  Database layer
  Milestone: |  (models, ORM)
Version:  1.2|   Severity:  Normal
 Resolution: |   Keywords:
   Triage Stage:  Accepted   |  Has patch:  1
Needs documentation:  1  |Needs tests:  1
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-

Comment (by wdoekes):

 Thanks for the motivation, anonymous :)

 New patch is against trunk, added other logical operators as well and
 added a proper testcase.

 Now this should work too:
 {{{
 MyModel.objects.update(is_enabled=((F('error_count') * 2) <
 F('success_count')))
 }}}

 I did have to replace an '==' check with an 'is' check in utils/tree. I'm
 assuming it has no negative side-effects.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16211: using negated F()-expression in update query

2011-06-18 Thread Django
#16211: using negated F()-expression in update query
-+-
   Reporter:  wdoekes|  Owner:  nobody
   Type:  New| Status:  new
  feature|  Component:  Database layer
  Milestone: |  (models, ORM)
Version:  1.2|   Severity:  Normal
 Resolution: |   Keywords:
   Triage Stage:  Accepted   |  Has patch:  1
Needs documentation:  1  |Needs tests:  1
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
Changes (by s.angel@…):

 * cc: s.angel@… (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16211: using negated F()-expression in update query

2011-06-18 Thread Django
#16211: using negated F()-expression in update query
-+-
   Reporter:  wdoekes|  Owner:  nobody
   Type:  New| Status:  new
  feature|  Component:  Database layer
  Milestone: |  (models, ORM)
Version:  1.2|   Severity:  Normal
 Resolution: |   Keywords:
   Triage Stage:  Accepted   |  Has patch:  1
Needs documentation:  1  |Needs tests:  1
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-

Comment (by anonymous):

 This is so indispensable !

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16211: using negated F()-expression in update query

2011-06-10 Thread Django
#16211: using negated F()-expression in update query
-+-
   Reporter:  wdoekes|  Owner:  nobody
   Type:  New| Status:  new
  feature|  Component:  Database layer
  Milestone: |  (models, ORM)
Version:  1.2|   Severity:  Normal
 Resolution: |   Keywords:
   Triage Stage:  Accepted   |  Has patch:  1
Needs documentation:  1  |Needs tests:  1
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
Changes (by aaugustin):

 * type:  Uncategorized => New feature
 * component:  Uncategorized => Database layer (models, ORM)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16211: using negated F()-expression in update query

2011-06-10 Thread Django
#16211: using negated F()-expression in update query
-+---
   Reporter:  wdoekes|  Owner:  nobody
   Type:  Uncategorized  | Status:  new
  Milestone: |  Component:  Uncategorized
Version:  1.2|   Severity:  Normal
 Resolution: |   Keywords:
   Triage Stage:  Accepted   |  Has patch:  1
Needs documentation:  1  |Needs tests:  1
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+---
Changes (by aaugustin):

 * needs_better_patch:   => 0
 * has_patch:  0 => 1
 * needs_docs:   => 1
 * needs_tests:   => 1
 * stage:  Unreviewed => Accepted


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



[Django] #16211: using negated F()-expression in update query

2011-06-10 Thread Django
#16211: using negated F()-expression in update query
---+---
 Reporter:  wdoekes|  Owner:  nobody
 Type:  Uncategorized  | Status:  new
Milestone: |  Component:  Uncategorized
  Version:  1.2|   Severity:  Normal
 Keywords: |   Triage Stage:  Unreviewed
Has patch:  0  |  Easy pickings:  0
UI/UX:  0  |
---+---
 Hi,

 as far as I can tell, there is currently no way to do this with the ORM:
 {{{
 UPDATE myapp_mymodel SET is_enabled = NOT is_enabled;
 }}}
 Using this:
 {{{
 MyModel.objects.update(is_enabled=(not F('is_enabled')))
 }}}
 .. becomes "is_enabled = true". And this:
 {{{
 MyModel.objects.update(is_enabled=~F('is_enabled'))
 }}}
 .. doesn't work, because the bitwise not operator is not defined on the
 `ExpressionNode`.

 I've done a patch against 1.2 to fix add that.

 It adds a unary "NOT"-connector to the `combine_expression` in
 `BaseDatabaseOperations` and it adds the `__invert__` method to the
 `ExpressionNode`.

 If you like this, I'll be happy to do a patch against trunk.

 Regards,[[br]]
 Walter Doekes[[br]]
 OSSO B.V.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.