Changes between Initial Version and Version 1 of Ticket #35147, comment 2


Ignore:
Timestamp:
Jan 27, 2024, 2:59:57 PM (10 months ago)
Author:
Simon Charette

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35147, comment 2

    initial v1  
    1313> If the fields that you’re combining are of different types you’ll need to tell Django what kind of field will be returned. Most expressions support output_field for this case, but since `F()` does not, you will need to wrap the expression with `ExpressionWrapper`:
    1414
    15 You haven't provided your model definition but I suspect wrapping `F("flags").bitand(2**34))` in `ExpressionWrapper(F("flags").bitand(2**34)), BigIntegerField())` will address your problem?
     15You haven't provided your model definition but I suspect wrapping `flag_some_flag` in `ExpressionWrapper(F("flags").bitand(2**34), BigIntegerField())` will address your problem?
    1616
    1717If that's the case I'm not against adjusting the 5.0 release notes to mention that non-wrapped arithmetic against integer fields might require adjustments, as documented, and possibly accepting a ticket to try to make the logic more ''generic'' wrt/ to integer field subclasses. Since this is clearly documented though I'm not convinced this qualifies as a release blocker that would warrant a code backport.
Back to Top