django-bootstrap5 icon indicating copy to clipboard operation
django-bootstrap5 copied to clipboard

Add pagination_extra_css to tag bootstrap_pagination

Open plenaerts opened this issue 1 year ago • 7 comments

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 :-)

plenaerts avatar Aug 15 '25 14:08 plenaerts

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?

dyve avatar Oct 19 '25 12:10 dyve

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.

plenaerts avatar Oct 19 '25 16:10 plenaerts

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

dyve avatar Oct 20 '25 05:10 dyve

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?

plenaerts avatar Oct 20 '25 06:10 plenaerts

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

dyve avatar Nov 02 '25 10:11 dyve

Great. Thanks for your feedback!

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

plenaerts avatar Nov 02 '25 13:11 plenaerts

Parameter is renamed to extra_classes.

plenaerts avatar Nov 10 '25 19:11 plenaerts