Prepopulated_fields doesn't work for StackedInline class while it works
fine for TabularInline class.
Please let me know if you need any more information.
--
Ticket URL: <https://code.djangoproject.com/ticket/28357>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => worksforme
Comment:
I tested with a a simple project and couldn't reproduce a problem. Please
provide more details.
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:1>
* cc: Ryan Siemens (added)
* status: closed => new
* version: 1.11 => 2.1
* resolution: worksforme =>
Comment:
Reopening as I ran into this issue (at least similar) today. Some
additional info:
The `prepopulated_fields` will work for the `extra` forms specified, in
the inline, but any additional forms added via "Add another <Model>" will
not run the js that pre populates the field.
Verified this issue is happening in 2.1 and 1.11 and attached a minimal
project that reproduces the issue.
To reproduce:
1. extract the attached project
2. run the migrations
3. create a superuser
4. navigate to `admin/myapp/blog/add/`
5. adding a title to extra forms in the the stacked inline articles
prepopulates the slug field
6. click "Add another Article"
7. ASSERT adding a title the newly added stacked inline article form does
**not** prepopulate the slug field
Here is a screen grab showing the results of steps 5-7
https://zappy.zapier.com/22F716E5-1D64-4763-B731-DE62D24F8FC0.mp4
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:2>
* Attachment "prepopulated-issue.tar.gz" added.
Minimal project to reproduce issue
* ui_ux: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:3>
* stage: Unreviewed => Accepted
Comment:
Thanks for the very detailed reproduction case Ryan.
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:4>
* status: new => assigned
* owner: nobody => Jakob Köhler
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:5>
* has_patch: 0 => 1
* version: 2.1 => master
Comment:
[https://github.com/django/django/pull/11221 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:6>
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:7>
* needs_tests: 1 => 0
Comment:
I added a test for the scenario defined by Ryan ✅
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:8>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:9>
* easy: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:10>
* owner: Jakob Köhler => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:11>
* owner: (none) => 1arshan
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:12>
* owner: ARSHAN AHMAD => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:13>
* owner: (none) => Deepchavan1
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:14>
* cc: Zoltán Szatmáry (added)
* owner: Deepchavan1 => Zoltán Szatmáry
Comment:
Yeseterday I made a PR for this one.
[https://github.com/django/django/pull/14967]
It only required changes in the **inlines.js** file.
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:15>
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:16>
* owner: Zoltán Szatmáry => Shubh Parmar
Comment:
Since there is no updates regarding this ticket for weeks, I want to work
on it.
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:17>
* cc: Shubh Parmar (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:18>
Comment (by Shubh Parmar):
PR: [https://github.com/django/django/pull/15091]
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:19>
* status: new => assigned
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
* easy: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:20>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:21>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:22>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"bb223c6f78afb94f4305fca945f54b8603bb0105" bb223c6]:
{{{
#!CommitTicketReference repository=""
revision="bb223c6f78afb94f4305fca945f54b8603bb0105"
Fixed #28357 -- Fixed ModelAdmin.prepopulated_fields on newly added
stacked inline.
Thanks Jakob Köhler for the initial patch.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28357#comment:23>