I think these ideas have been floated before. If you look through the Trac tickets you might find something related. However, your subclass where you store "self.instance" on ModelAdmin is a no no due to thread safety. See http://stackoverflow.com/questions/3388111/modeladmin-thread-safety-caching-issues for an explanation.
On Thursday, September 15, 2016 at 6:53:15 PM UTC-4, th...@copperleaf.com wrote: > > I have a ModelAdmin subclass (code at: <https://dpaste.de/0LAt>) and I > need to do a couple of things, but the functionality seems to be missing: > > 1. I need to access the model instance to perform some initialization, but > there's no instance member set. There are a few questions on Stack Overflow > on this topic, so I know I'm not alone. > > 2. I need to initialize my form with a parameter derived from the model > instance. If this were a View, I could just override get_form_kwargs and be > done with it, but ModelAdmin doesn't have it. > > Is there a reason why those two features are missing from ModelAdmin? > Maybe they could be added (and I could open a PR)? Or is there a better way > to do what I need to do? > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8555185b-0cec-4fc7-96e5-0cdb2ff7d8c5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.