| 614 | | == Changed Where Node Internals == |
| 615 | | For anybody writing custom Q-like objects or advanced filter additions with the !QuerySet class, [7773] changed the information that is passed to the Where class by default. A standard leaf node in the Where class used to be |
| 616 | | |
| 617 | | {{{ |
| 618 | | #!python |
| 619 | | [table_alias, field_name, field_instance, lookup_type, value] |
| 620 | | }}} |
| 621 | | |
| 622 | | This changeset removed the need to store any field instances (in `field_instance`) or model references (in the `value`). The new list in the leaf nodes is now |
| 623 | | |
| 624 | | {{{ |
| 625 | | #!python |
| 626 | | [table_alias, field_name, db_type, lookup_type, value_annotation, params] |
| 627 | | }}} |
| 628 | | |
| 629 | | The `db_type` is the result of `field.db_type()` or `None` if `field` was None previously. The `value_annotation` is usually `bool(value)`, but it is `datetime.datetime` if the previous `value` was a datetime. Finally, `params` is the result of `value.db_prep_lookup()` or equivalent and must be a sequence (so if you're passing in a value directly, wrap it in a list or a tuple). |
| 630 | | |
| 631 | | Again, this will not affect most code, but people writing customised things will need to adjust. Fortunately, since the list is now one component longer, if you miss a change, your code will fail drastically so you will notice. |
| 632 | | |