#29505: Impossible to set a Field's default value to a callable that takes an
argument
---------------------------------+--------------------------------------
     Reporter:  Eugene Pakhomov  |                    Owner:  nobody
         Type:  Uncategorized    |                   Status:  closed
    Component:  Migrations       |                  Version:  2.0
     Severity:  Normal           |               Resolution:  wontfix
     Keywords:  default          |             Triage Stage:  Unreviewed
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------
Changes (by Tim Graham):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 I believe the proposed patch would break callable defaults. In
 `effective_defautl()`, `field.get_default()` may return a callable and
 `Field.get_prep_value()` won't work properly if it receives a callable
 instead of a value. I guess test coverage is lacking.

 I think you should change your `__call__()` method to make `other` an
 optional argument.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29505#comment:3>
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/065.598dc427524698e61e01cd040ac2217b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to