Code

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#13300 closed (worksforme)

Collapsable fieldsets broken in StackedInline

Reported by: emyller Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: collapse,admin,javascript
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When a StackedInline item's extra = 0, the Show/Hide toggle link doesn't work in newly added entries.

I guess it happens due to the fact that the current js adds the click event listener to the existent links only (it works if there are entries previously saved, loaded with the changeform page). It should watch for clicks "lively" (this is what jQuery's .live does , I think).

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

I think this may have been fixed by r12937.

Here's my test case (using a Book model that is inline to something else):

class BookInline(admin.StackedInline):
    model = Book
    extra = 0
    fieldsets = (
        ('other', {
            'fields': ('name','pages'),
            'classes': ('collapse',),
        }),
    )

I can't see any unusual behaviour with r12937; but if I revert to r12936, nothing added as an extra after the page render works properly.

If I've misunderstood your report, please reopen, providing a specific example of a StackedInline definition that doesn't work as expected.

comment:2 Changed 4 years ago by emyller

shameonme, it worked for me now too. guess it was a caching problem (Chrome weirdness?).

comment:3 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.