Closed jerch closed 10 years ago
That's pretty much what #13 allows, but through methods rather than attributes (make it more flexible).
I get your point and just saw your commits, sorry for double posting. Actually I've patched it myself for my needs one line after your patch (the initial dictionary). How about doing both attribute and method based API enhancements? Would somewhat reflect the django way for many class attributes and their get_ method counterparts.
I don't have the last word, but I wouldn't tend to favor it. The double approach is conceptually tangled, for dubious advantages.
class MyAdmin(ClonableModelAdmin):
def tweak_cloned_fields(self, fields):
return dict(fields, **{
'myfield': 'initial value',
})
isn't so much more complex than:
class MyAdmin(ClonableModelAdmin):
initial_clone_attrs = {
'myfield': 'initial value',
}
Thanks for the idea @jerch, I think I'm with @hsoft on this one. I rather have only one way to do the same thing.
I'll close this issue in favor of #13 . Thanks!
It would be nice to have an attribute to set some fields to initial values upon cloning.