New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically assign processors and etc. #65
Comments
@lettertwo just asked me about this so I thought I'd let everybody know my thoughts—and let you (@nishimu) know that I'm not ignoring you! There is definitely a use-case for this; #11 is an example. Having said that, I'm not sure I'm a fan of allowing a I think the idea of a callable "processors" argument may be too narrow of a solution. What you (and @koebbe) want, in effect, is to define different specs based on properties of the model. I'm still trying to figure out if there's a way to do that that fits with how we're used to working with Django fields. Ultimately, the answer may just be to allow callables for all the arguments, but I want to see if we can't come up with something better first. Anybody have any good ideas for alternatives here? Or examples of Django libraries with fields that change behavior based on model properties? |
How about making it posible to define the ImageSpec inside the init of the model after the super init? |
Sorry for dragging my feet on this one. @jokerejoker Unfortunately, model fields don't really work like that. In the case of ImageSpec, we could probably get it to work, but I think the result would be without precedent and tie our hands in the future if we need to do more bookkeeping in the Ultimately, I think that the best option we have (or at least the best one we've been able to come up with!) is to allow callables to be used for the processors argument. And, lucky for us, @cyberdelia has done that work for us in #85! I've pulled his changes into develop with commit 3bac472. @nishimu Sorry again for dragging my feet so long on this solution (only to finally settle on what you suggested initially). I still have my original objections but the perfect is the enemy of the good, and we've gone long enough without a solution. |
I want to assign the processors parameter for each instance.
For example, a ImageSpec is following;
and I want to change contrast, sharpness, and the Transpose method at runtime for each instance.
I found the similar request at #11 issue.
#11 expects more general way, but I don't have a good idea for #11
My idea is;
Is it an effective change or not?
The text was updated successfully, but these errors were encountered: