Opened 12 years ago
Closed 12 years ago
#22135 closed New feature (fixed)
Implement ModelAdmin.get_initial_data
| Reported by: | Adam Avramov | Owned by: | Greg Chapple |
|---|---|---|---|
| Component: | contrib.admin | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
At the present moment, the admin's add view is hard-coded to get initial values from request.GET (see https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1363), which strikes me as quite inflexible. Would anyone be interested in seeing a get_initial_data(self, request) method added to ModelAdmin, which could then be overridden to specify arbitrary initial data for new objects?
Change History (6)
comment:1 by , 12 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|---|
| Version: | 1.4 → master |
comment:2 by , 12 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 12 years ago
| Has patch: | set |
|---|
Created pull request for this ticket: https://github.com/django/django/pull/2373
comment:5 by , 12 years ago
| Patch needs improvement: | unset |
|---|
I have just updated the pull request following comments.
comment:6 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Makes sense to me.