Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StackedInline and collapse bug #21

Open
P3RI9 opened this issue Feb 24, 2022 · 2 comments
Open

StackedInline and collapse bug #21

P3RI9 opened this issue Feb 24, 2022 · 2 comments

Comments

@P3RI9
Copy link

P3RI9 commented Feb 24, 2022

Hi! It worked as expected, thanks for the project! I only wanted to know if this pagination could be used with StackedInline instead of TabularInline. This would be perfect for my project.

Also, I don't know if it is a know bug but when you use classes=['collapse'] on the inline, the page numbers doesn't collapse, they keep out of it.
image

@MrMika96
Copy link

I managed to add pagination to StackedInline by doing this

class YourAdminInline(InlinePaginated, admin.StackedInline):
    model = YourModel
    per_page = 10
    template = f'{BASE_DIR}/templates/stacked_paginated.html' #path to your template

And then go to your template folder and create stacked_paginated.html like this:

{% include 'admin/edit_inline/stacked.html' %}
<div class="admin-tabular-inline-pagination">
    {% include 'admin/tabular_paginator.html' %}
</div>

@maqnius
Copy link

maqnius commented Dec 4, 2024

Referring to the initial question, the pagination for collapsed inlines can be hidden using the following CSS

div.inline-group + div.admin-tabular-inline-pagination {
    display: none;
}
div.inline-group:has(details[open]) + div.admin-tabular-inline-pagination {
    display: initial;
}

I thought it might help someone :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants