jmcclell / django-bootstrap-pagination

Django template tag for rendering Page objects as Bootstrap pagination HTML
MIT License
212 stars 83 forks source link

Linking to an anchor within a page #35

Closed mhb11 closed 8 years ago

mhb11 commented 9 years ago

I used bootstrap pagination in my template like so: {% bootstrap_paginate page_obj range=10 show_prev_next="false" show_first_last="true" %}

Each index links to www.example.com/?page=n under this scheme.

I want it to link to www.example.com/?page=n#top instead. I.e. I have <a name=top> defined in each page that I want the paginated links to redirect to.

I can't figure out how to do that via bootstrap pagination. Can you show it to me via an example? Is it even possible?

Looking forward to hearing back from you.

mhb11 commented 9 years ago

@jmcclell any word on this?

jmcclell commented 9 years ago

You know, I am not sure if this is possible or not.

The only way for it to be possible, currently, is if anchors are supported in django paths themselves which the template lib uses directly by name. I have not used django in quite some time, unfortunately, so I am not sure if it would be possible.

If it is not supported by django paths themselves, then an additional property would be needed to append them at render-time. I vaguely recall a PR for doing this at one point, perhaps yours?

jmcclell commented 9 years ago

Here you go: https://github.com/jmcclell/django-bootstrap-pagination/pull/25

I've merged this in. I had been hoping to have some time to write some tests before doing any more merges, but this one is pretty basic. Let me know if you have any issues with it.