#34160: Django 4.1 Expression contains mixed types for (Big/Small)IntegerFields.
-------------------------------------+-------------------------------------
     Reporter:  Martin Lehoux        |                    Owner:  Martin
                                     |  Lehoux
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  4.1
  (models, ORM)                      |
     Severity:  Release blocker      |               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 Martin Lehoux):

 Isn't it the `Case` that has an issue computing it's `output_field`? If
 it's the case, I'm not sure that the files you pointed to me were the
 right ones.
 ''django/db/models/expressions.py''

 {{{
 @deconstructible(path="django.db.models.Case")
 class Case(SQLiteNumericMixin, Expression):
     """
     An SQL searched CASE expression:

         CASE
             WHEN n > 0
                 THEN 'positive'
             WHEN n < 0
                 THEN 'negative'
             ELSE 'zero'
         END
     """

     template = "CASE %(cases)s ELSE %(default)s END"
     case_joiner = " "

     def __init__(self, *cases, default=None, output_field=None, **extra):
         if not all(isinstance(case, When) for case in cases):
             raise TypeError("Positional arguments must all be When
 objects.")
         super().__init__(output_field)
         self.cases = list(cases)
         self.default = self._parse_expressions(default)[0]
         self.extra = extra
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34160#comment:9>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701848189cfe7-5ccf35d5-05c8-4a88-b5d4-e3f13e4f8a8b-000000%40eu-central-1.amazonses.com.

Reply via email to