#11639 closed New feature (fixed)
Can't remove prepopulated fields from fieldset in ModelAdmin
Reported by: | leanmeandonothingmachine | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.3-beta |
Severity: | Normal | Keywords: | sprintnov13 |
Cc: | Ben Spaulding | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I'd like to propose that when the prepopulated fields argument that is passed to the AdminForm helper in BaseModelAdmin is generated by a method that takes the request object. That would give you ability to use the get_fieldsets overide to filter out prepopulated fields and then use this new override to alter the prepopulated fields to match what you did in get_fieldsets. See attached patch for my implementation.
Attachments (1)
Change History (19)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:4 by , 14 years ago
milestone: | → 1.3 |
---|---|
Version: | 1.1 → 1.2 |
Updated the patch again. If there is anything wrong with this that is holding it up please lmk, i'd be happy to improve it.
comment:5 by , 14 years ago
Keywords: | sprintnov13 added |
---|
comment:6 by , 14 years ago
Cc: | added |
---|
comment:7 by , 14 years ago
milestone: | 1.3 → 1.4 |
---|---|
Needs documentation: | set |
Needs tests: | set |
That's a useful feature, but unfortunately it is too late for 1.3.
by , 14 years ago
Attachment: | pre_populated.diff added |
---|
comment:8 by , 14 years ago
milestone: | 1.4 → 1.3 |
---|---|
Version: | 1.2 → 1.3-beta |
I updated the patch to include tests and documentation. I also added inline support based on the way get_readonly_fields works. Can this be considered for 1.3? If it really is too late then change it back to 1.4, it would be nice though to have this get some attention.
comment:9 by , 14 years ago
Needs documentation: | unset |
---|---|
Needs tests: | unset |
comment:10 by , 14 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
This is a good patch, thanks for your great work. There's no guarantee that it can make it in 1.3 as this is essentially a new feature and we're now in beta stage. So we'll see ;)
comment:11 by , 14 years ago
milestone: | 1.3 → 1.4 |
---|
Agreed that this looks like a good idea, but it's definitely a new feature, not a bug fix, so it can't be added to 1.3 at this point.
comment:12 by , 14 years ago
Ok, on the other hand it could be considered a fix for the bug in #13618
comment:13 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:14 by , 14 years ago
Easy pickings: | unset |
---|
This is definitly a fix for #13618 too.
Additionally it solves a problem when trying to manually fix the #13618 issue by changeing the prepopulated_fields e.g. in the change_view.
As this is a dictionary shared over all instances of the Adminmodel, after altering it you lost the prepopulating feature until server refresh.
follow-up: 18 comment:17 by , 13 years ago
UI/UX: | unset |
---|
Any reason why this ticket didn't entered 1.3.1? It's still set for 1.3-beta. I would like to see this checked in for 1.3.2, let me know if I can help with tests or documentation. It's pretty annoying to have the get_fieldsets
hook available but see it fail because of prepopulated_fields
, and then rewrite almost half of the ModelAdmin to fix it.
comment:18 by , 13 years ago
Replying to hcarvalhoalves@…:
Any reason why this ticket didn't entered 1.3.1?
It's because bug fixes like this are no longer backported to the stable branch - it will not be in the next 1.3.X release. See https://docs.djangoproject.com/en/dev/internals/release-process/#supported-versions -- We changed our backporting policy for the maintenance period post 1.3.
It's still set for 1.3-beta
I was reported as present in 1.3 beta (Version field of this ticket) but it was targetted to be fixed in 1.4 (Milestone field, since then removed from our Trac installation)
I would like to see this checked in for 1.3.2, let me know if I can help with tests or documentation. It's pretty annoying to have the
get_fieldsets
hook available but see it fail because ofprepopulated_fields
, and then rewrite almost half of the ModelAdmin to fix it.
You can always port the changes committed to fix this ticket (or a subset of them) to a local copy of the 1.3.X branch and use that.
Sorry that should be in ModelAdmin not BaseModelAdmin