#22351: New django migrations and places where lambdas are supposed
-------------------------------+--------------------------------
Reporter: dimyur27@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: master
Severity: Normal | Keywords: migrations lambdas
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------
In Django's model fields there are a lot of places where lambdas are the
most obvious way to get things done.
Many keyword arguments can accept callable objects which do not supposed
to do complex logic, but some simple things.
E.g. ForeignKey.limit_choices_to, FileField.upload_to...
Example from Django Docs:
limit_choices_to = lambda: {'pub_date__lte': datetime.date.utcnow()}
But Django's migrations cannot cope with lambdas passed as keyword
arguments, so that fact either should be mentioned in the docs (let
examples use named functions rather than lambdas) or community has to put
extra attention on migrations+lambdas problem.
Thanks for the magnificent framework! My best regards.
--
Ticket URL: <https://code.djangoproject.com/ticket/22351>
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/061.487ad583acdeedb632991b3657fa9368%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.