Opened 16 years ago

Last modified 4 years ago

#9107 new New feature

URL arguments to set values of fields in admin don't work for inlines

Reported by: josh@… Owned by:
Component: contrib.admin Version: dev
Severity: Normal Keywords: admin inline
Cc: Carlton Gibson Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Though it works just fine to set the value of a field in the admin with URL arguments (i.e. adding '?title=foo' to your URL sets the value of the field 'title' to 'foo'), this doesn't work if the field you're trying to set is in an inline. In such a case the syntax would presumably be something along the lines of '?inlinemode_set-0-fieldname' if you were trying to set the value fo the first instance of the inline model. This, however, doesn't work nor does any other variation I was able to think of.

Change History (11)

comment:1 by Jacob, 16 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Luke Plant, 14 years ago

Severity: Normal
Type: New feature

comment:3 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:4 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:5 by TapanGujjar, 5 years ago

Owner: changed from nobody to TapanGujjar
Status: newassigned

comment:6 by TapanGujjar, 5 years ago

For this feature, the correct query parameter for inline models according to me should look something as inlinemode_set-[inline model index]-[index of the inline formset]-[fieldname]. Also, should the inline parameters override the extra parameter in the custom inline Model as if we have more inline query parameters means for the inline mode we will have to show more inline form just to show those more query parameters

Version 0, edited 5 years ago by TapanGujjar (next)

comment:7 by Carlton Gibson, 5 years ago

Cc: Carlton Gibson added

Any ideas for this.

Easier to see in code, I think.

After 12 years, you're free to implement your idea. (It sounds generally reasonable.)

If you can open a PR with the easier cases handled and then perhaps failing test cases for the more difficult examples it will be easier to comment sensibly.
Does that seems an OK plan?

comment:8 by TapanGujjar, 5 years ago

Hi Carlton please check the pull request for this. I have created two tests to demonstrate my solutions. One of the test will fail.

https://github.com/django/django/pull/12882

comment:9 by Carlton Gibson, 5 years ago

Has patch: set
Patch needs improvement: set

comment:10 by Carlton Gibson, 5 years ago

Needs documentation: set
Needs tests: set

comment:11 by TapanGujjar, 4 years ago

Owner: TapanGujjar removed
Status: assignednew
Note: See TracTickets for help on using tickets.
Back to Top