On 05/03/14 23:05, Jeremy Dunck wrote:
> if ...
> elif isinstance(value, LazyObject):
> pass
> elif callable(value):
> ...
My gut instinct is that if Django's template code has to be patched and
special cased to accommodate this change, there will be lots of other
code that needs to be patched too.
LazyObject is already pretty hairy without trying to get it to support
more things.
Also, it seems that normally there should be other solutions. In many
cases, instead of:
User = SimpleLazyObject(lambda: get_user_model())
you could use:
User = lambda **kwargs: get_user_model()(**kwargs)
...assuming that the only thing you need 'User' to do is to produce User
instances when you call it. (If you need it to be an actual class for
some reason, then this won't work - but in most cases I'd suggest that
the consuming code shouldn't need an actual class).
Regards,
Luke
--
"God demonstrates his love towards us in this, that while we were
still sinners, Christ died for us." (Romans 5:8)
Luke Plant ||
http://lukeplant.me.uk/