#34160: Django 4.1
-------------------------------------+-------------------------------------
               Reporter:  Martin     |          Owner:  nobody
  Lehoux                             |
                   Type:             |         Status:  new
  Uncategorized                      |
              Component:  Database   |        Version:  4.1
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Hi,

 During an update from Django 4.0.8 to 4.1.3, an unexpected bug occured in
 our tests.

 {{{
 django.core.exceptions.FieldError: Expression contains mixed types:
 IntegerField, SmallIntegerField. You must set output_field.
 }}}

 I understand what it means, but I couldn't find what changed between these
 two versions that could explain the appearance of this error.


 {{{
 Case(
     When(
         True,
          then=F("inventory_count") + Value(1),
     ),
     default=F("inventory_count"),
 )
 }}}

 I could easily fix it with

 {{{
 Case(
     When(
         True,
          then=F("inventory_count") + Value(1),
     ),
     default=F("inventory_count"),
     output_field=IntegerField(),
 )
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34160>
Django <https://code.djangoproject.com/>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701847c0d5d5d-914c470a-cb08-497a-bf8a-f90df36aa5b6-000000%40eu-central-1.amazonses.com.

Reply via email to