[Django] #34160: Django 4.1

2 views
Skip to first unread message

Django

unread,
Nov 15, 2022, 11:09:25 AM11/15/22
to django-...@googlegroups.com
#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.

Reply all
Reply to author
Forward
0 new messages