Re: [Django] #15760: Feature: JS Hooks for Dynamic Inlines

26 views
Skip to first unread message

Django

unread,
Oct 3, 2011, 4:23:25 AM10/3/11
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
--------------------------------+------------------------------------
Reporter: mlavin | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: SVN
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
--------------------------------+------------------------------------
Changes (by jaap3):

* cc: jaap3 (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 14, 2012, 2:14:45 PM2/14/12
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner: mlavin
Type: New feature | Status: new
Component: contrib.admin | Version: SVN
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback | Needs documentation: 1
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 1
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by anonymous):

* keywords: inlines jquery => inlines jquery callback
* owner: nobody => mlavin


--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:6>

Django

unread,
Mar 12, 2012, 7:47:48 AM3/12/12
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: SVN
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback | Needs documentation: 1
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 1
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by mlavin):

* owner: mlavin =>


--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:7>

Django

unread,
May 17, 2012, 4:24:17 PM5/17/12
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback | Needs documentation: 1
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 1
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by CollinAnderson):

* cc: cmawebsite@… (added)


Comment:

I ran into this issue two years ago, and I am running into it again today.
I ended up having to clone django's add link, hide the original, add my
own click handler, then call django's click handler on the original
element.

It looks like a few others have ran into this issue too.
- http://code.google.com/p/django-tinymce/issues/detail?id=89
- http://stackoverflow.com/questions/7133189/django-stackedinline-tinymce-
problem

I believe the posted patch would solve the problem for me, maybe put a
django namespace prefix on it just to be save.

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:8>

Django

unread,
May 17, 2012, 4:48:53 PM5/17/12
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback | Needs documentation: 1
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 1
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by mlavin):

I ended up working around this issue in my own project by monkey patching
{{{django.jQuery.fn.formset}}}. I still think that adding these events
would be helpful but I think that https://github.com/django/django/pull/24
largely reduces the need for them if it is accepted.

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:9>

Django

unread,
May 17, 2012, 5:04:30 PM5/17/12
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback | Needs documentation: 1
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 1
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by CollinAnderson):

Ahh, yes, #18241 would also solve this for me.

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:10>

Django

unread,
Jul 23, 2012, 8:54:02 PM7/23/12
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback | Needs documentation: 1
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 1
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by mpasternak):

I like the inlines.diff patch, because it is more explicit this way. I
don't think there's anything wrong with having clearly named events on the
javascript side, is there?

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:11>

Django

unread,
Nov 19, 2012, 2:23:47 PM11/19/12
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback | Needs documentation: 0

Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 1
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by per856):

* needs_docs: 1 => 0


Comment:

Updated this patch to current master, with some alterations. Added
documentation.

Patch: https://github.com/django/django/pull/542

This fix also fixes accepted duplicate #19314

Example usage:
{{{
django.jQuery(document).bind('formset_add.admin.my_widget',
function(event, row_element) {
my_widget_setup($('.my_widget', row_element));
});
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:12>

Django

unread,
Nov 28, 2012, 12:16:22 PM11/28/12
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1

Needs tests: 0 | UI/UX: 1
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by julien):

* needs_better_patch: 0 => 1


Comment:

Thanks for your work on the patch.

In the example usage above, you bind the event
'formset_add.admin.my_widget'. Is that a typo (i.e. the 'my_widget' part)?

Also, what would happen when the page would contain multiple types of
inlines? How would you discriminate between the various inlines? If you
could please elaborate on the approach a developer would have to follow,
that would be helpful — and in fact, this could also be added to the
documentation.

Finally, to include this patch in Django core, some tests would have to be
written. Would you like to have a go at writing some Selenium tests
demonstrating the use of this new feature?

Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:13>

Django

unread,
Oct 23, 2013, 12:58:54 PM10/23/13
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1
Needs tests: 0 | UI/UX: 1
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by gstrat):

* cc: gstrat (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:14>

Django

unread,
Jun 17, 2015, 10:45:09 PM6/17/15
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by RamezIssac):

How About to extend the current plugin default to accept say
'addedCallback' and 'deletedCalback' which can be assigned in to the
django.jQuery.fn.formset.default . Those are left for the user to fill
The Tabluar & Stacked inline js can callback those function along with
their 'added' function

And as answer to julien question about what if many inline existed on a
page , we can send both the created form and the formset name.

For using this new feature, a change_form template is extended for the
model you want to work with, and we add the javascript function of desire
inside the HTML template. Mainly in the change_form_document_ready block
or maybe a new block (where missing block.super is not gonna mess things
up)

I can do that if idea is accepted

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:15>

Django

unread,
Jun 18, 2015, 8:15:20 AM6/18/15
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by RamezIssac):

Adding a formset defaults in the document_ready block is too late for the
defaults to get picked up.
The plugin is Initiated by the edit_inline/tabular.html (or stacked) , at
the end of inline_field_sets block

The other option i see is on the extrahead block

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:16>

Django

unread,
Jun 18, 2015, 12:38:20 PM6/18/15
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by RamezIssac):

* cc: RamezIssac (added)


Comment:

PR created [https://github.com/django/django/pull/4883 4883]

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:17>

Django

unread,
Aug 2, 2015, 3:55:43 AM8/2/15
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback |
Has patch: 1 | Needs documentation: 1

Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by RamezIssac):

* needs_docs: 0 => 1


Comment:

PR is created already, with tests that pass! but missing documentation.

Any Idea on where this feature documentation should go in the Django admin
documentation.

After the hint i'll write down the documentation in the hinted location
and it is ready for review.

Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:18>

Django

unread,
Aug 3, 2015, 8:36:37 AM8/3/15
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback |
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by RamezIssac):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:19>

Django

unread,
Aug 3, 2015, 2:05:36 PM8/3/15
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback |
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by timgraham):

Maybe a new page at `docs/ref/contrib/admin/javascript.txt` would make
sense. Anyway, the content is more important than the location at this
point.

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:20>

Django

unread,
Aug 4, 2015, 5:44:39 AM8/4/15
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback |
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by RamezIssac):

Indeed , thank you Tim.
I added an 'initial documentation' , there is a small problem in
''docs/ref/contrib/admin/javascript'' line 19 , I couldn't figure out how
to make a proper link.
Waiting for feedback regarding this and any other.

Best Regards.

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:21>

Django

unread,
Aug 5, 2015, 6:14:43 AM8/5/15
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by RamezIssac):

* needs_docs: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:22>

Django

unread,
Sep 1, 2015, 12:53:28 PM9/1/15
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:23>

Django

unread,
Sep 12, 2015, 7:47:09 AM9/12/15
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by RamezIssac):

* needs_better_patch: 1 => 0


Comment:

Added JavaScript tests along with documentation enhancement.

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:24>

Django

unread,
Sep 19, 2015, 6:57:29 PM9/19/15
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


Comment:

Reviewed the updated patch.

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:25>

Django

unread,
Sep 20, 2015, 8:03:44 AM9/20/15
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inlines jquery | Triage Stage: Accepted
callback |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by RamezIssac):

* needs_better_patch: 1 => 0


Comment:

Improvements made. Kindly review. Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:26>

Django

unread,
Sep 21, 2015, 3:38:01 PM9/21/15
to django-...@googlegroups.com
#15760: Feature: JS Hooks for Dynamic Inlines
-------------------------------------+-------------------------------------
Reporter: mlavin | Owner: Tim
| Graham <timograham@…>
Type: New feature | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: inlines jquery | Triage Stage: Accepted
callback |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* owner: => Tim Graham <timograham@…>
* resolution: => fixed


Comment:

In [changeset:"1335aa2fb9f590d786a5baee1b781377dc3a2ec8" 1335aa2]:
{{{
#!CommitTicketReference repository=""
revision="1335aa2fb9f590d786a5baee1b781377dc3a2ec8"
Fixed #15760 -- Added JavaScript events for admin inline forms.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/15760#comment:27>

Reply all
Reply to author
Forward
0 new messages