Skip to content

Conversation

@plenaerts
Copy link

I wanted to tweak the looks of the pagination block, so I added a parameter to the existing tag bootstrap_pagination which attaches an extra CSS class to the rendered pagination ul element.

Docs and tests are included.

Please consider merging, or let me know if you want me to correct or improve things, or even if you find it just useless :-)

@dyve
Copy link
Member

dyve commented Oct 19, 2025

I'm wondering if the same effect (without adding to the library) could be obtained by

<div class="my-wrapper-class">
{% bootstrap_pagination ... %}
</div>

And then styling your CSS using my-wrapper-class and contained Bootstrap CSS.

Would that work for you?

@plenaerts
Copy link
Author

I'm wondering if the same effect (without adding to the library) could be obtained by

I don't think I agree, no. Applying the class directly to the element is more clear and simple:

  • There is one less DOM element.
  • There is less chance for side effects in the layout.
  • Applying classes directly to elements is in general "how bootstrap does it".

So, while there may be many cases where another div "might just work", I think applying the class directly to the pagination ul is the more clear and more clean way.

@dyve
Copy link
Member

dyve commented Oct 20, 2025

How about we add support for extra_classes like in other elements?

@plenaerts
Copy link
Author

I think that would be more consistent with the other django-bootstrap5 elements, yes.

Two questions:

  1. I only spotted button and alert. Are there other elements or uses you're considering which I'm missing and which could relate to this?
  2. To me it looks like a rename of the pagination_extra_css parameter to extra_classes. Do you agree?

@dyve
Copy link
Member

dyve commented Nov 2, 2025

I'd keep it limited to just pagination and use extra_classes.

@plenaerts
Copy link
Author

Great. Thanks for your feedback!

I'll rename the parameter when I find the time and let you know.

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

Successfully merging this pull request may close these issues.

2 participants