django-hijack-admin
django-hijack-admin copied to clipboard
HijackUserAdminMixin should live in a separate file
Anyone who has existing customizations will want to avoid the unregister/register code and use the mixin on it's own. However - this currently isn't possible as HijackUserAdminMixin is in the same module. I'd suggest moving it to a module called something like admin_mixins.py and importing it from there.
(That does raise the question of why the non-mixin version is needed at all. In theory - appending to list_display should be fairly safe - it's the register/unregister that could cause problems)
I agree on the point to move the HijackUserAdminMixin to a separate file, but why is it not possible to import the HijackUserAdminMixin from the admin module?
The register/unregister code is only executed when the HIJACK_REGISTER_ADMIN is set to True. You always can modify this and the register/unregister code wouldn't be executed.
The non-mixin version is used for this app to work "out-of-the-box", so users will only have to pip install an can use the app without further changes.
The register/unregister code is only executed when the HIJACK_REGISTER_ADMIN is set to True.
Hmmmm. It's possible I just didn't spot this at the time. However that setting defaults to True and it's a bit messy.
Someone has to:
a) Make the connection between the import problem and the existence of that setting b) Patch their settings to solve the problem
Isn't it cleaner to set up the file structure in such a way that it "just works"?
@Mogost can you add a note explaining how this was completed?
@Mogost can you add a note explaining how this was completed?
This package is abandoned. (actually integrated in the main package). You can follow the doc. https://django-hijack.readthedocs.io/en/latest/#django-admin-integration I don't think this problem is still actual for current implementation.