#29505: Impossible to set a Field's default value to a callable
-------------------------------------+-------------------------------------
Reporter: Eugene | Owner: nobody
Pakhomov |
Type: | Status: new
Uncategorized |
Component: Database | Version: 2.0
layer (models, ORM) |
Severity: Normal | Keywords: default
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
I'm trying to use https://github.com/cognitect/transit-python and I
created a custom `KeywordField` for this.
The problem is that `transit.transit_types.Keyword` is a callable. Now,
even if I override `_get_default` in `KeywordField`, it still won't work
because
`django.db.backends.base.schema.BaseDatabaseSchemaEditor#effective_default`
checks the value again.
I think a simple fix would be to remove this check from
`effective_default` and immediately make a call where it's necessary
(`datetime.date` etc).
--
Ticket URL: <https://code.djangoproject.com/ticket/29505>
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.9c8fae918310d368b274749ad4c21eba%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.