#26899: RawSQL requires parameters even if they are empty
----------------------------------------------+--------------------
     Reporter:  wolever                       |      Owner:  nobody
         Type:  Uncategorized                 |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  master
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  1                             |      UI/UX:  0
----------------------------------------------+--------------------
 The `params` argument to `RawSQL` isn't optional so an empty tuple must be
 provided if no arguments are needed:

 {{{
 >>> RawSQL("some_column")
 ...
 TypeError: __init__() takes at least 3 arguments (2 given)
 }}}

 It seems reasonable to make `params=()` the default: `RawSQL(sql,
 params=(), output_field=None)`, or possibly `params=None` and `self.params
 = params if params is not None else ()`.

 See also:
 
https://github.com/django/django/blob/master/django/db/models/expressions.py#L607

--
Ticket URL: <https://code.djangoproject.com/ticket/26899>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.c5fe52a9d97a3a223d482fb6e18701ed%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to