Opened 6 months ago
Closed 6 months ago
#35552 closed New feature (wontfix)
[Django Admin] Harmonizing obj=None parameter across multiple function
Reported by: | Sven R. Kunze | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Sven R. Kunze | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Searching the issue tracker didn't reveal anything useful. Please point me at the right issue if this topic has already been discussed elsewhere. :-)
During several projects, we worked around an issue of Django Admin. When using the following methods:
formfield_for_dbfield
formfield_for_choice_field
formfield_for_foreignkey
formfield_for_manytomany
get_field_queryset
get_autocomplete_fields
get_changeform_initial_data
the current instance is really useful for complex applications, but it is not provided though.
Our current work-around: reparsing request.path_info and retrieving the object once again. In addition to the code redundancy, it's an additional performance loss.
As a solution, we propose the following:
- harmonize the
obj=None
parameter across those method likeget_fields
orget_readonly_fields
.
Hi Sven,
The best place to discuss new features is the Django forum so I recommend you take this there to get feedback from the community.
I would also say that having a simple/small example of how you've "worked around an issue of Django Admin" would help with this discussion. You may find there are other ways to approach the problem 👍