Code Monkey home page Code Monkey logo

dj-pagination's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ”ญ Iโ€™m currently working for @octoenergy on decarbonizing the planet
  • ๐Ÿ˜„ Pronouns: he/him
  • ๐Ÿ I code mostly in Python, but also some NodeJS and Rust
  • ๐ŸŒฑ Iโ€™m currently learning Rust
  • ๐ŸŒŽ Contact me if you want to join me in decarbonizing the planet
  • ๐Ÿฅ‹ I'm currently training in Brazilian Jiu-Jitsu for sport and Tai Chi to help recover from a bike injury
  • ๐Ÿ“ซ How to reach me:
  • โšก Fun fact: I met my wife at PyCon US in 2010. She is awesome, her GH account is @audreyfeldroy

dj-pagination's People

Contributors

amcorreia avatar amiroff avatar atugushev avatar audreyfeldroy avatar backscratcher avatar barttc avatar brosner avatar carljm avatar ericbgarnick avatar fabiocorneti avatar gitter-badger avatar hgrimelid avatar jimmyye avatar jmichalicek avatar justquick avatar leah avatar martinsvoboda avatar mjtorn avatar mktums avatar ptone avatar pydanny avatar spanasik avatar spookylukey avatar stephane avatar strogonoff avatar tiagosamaha avatar tzangms avatar xordoquy avatar zsiciarz avatar zyga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dj-pagination's Issues

Sometimes the {% paginate using 'mypath\pagination.html' %} was no useful

When I used the function like {% paginate using 'mypath\pagination.html' %}.
I used the same setting and code๏ผŒit worked on my windows10 compute, but on my Ubuntu system compute it was no useful.
I used below code, please review, thanks very much!

...
{% block content %}
    {% autopaginate object_list 5 as object_list_list %}
    {% for object in object_list_list %}
        ...
    {% endfor %}
    <div class="paginate">
        {% paginate using 'pagination\article\pagination.html' %}  # This DTL can't work
    <div>
{% endblock content %}
...

About pagination.html path

i hope give a choose that use the pagination.html in the project(like in templates),
it will easy to extend and move to server

How do I add gap between the page numbers displayed at the bottom?

I use {% paginate %} at the bottom of a table and it works perfectly, but the page numbers are too close to each other. I see that we can do {% paginate using 'template.html' %}, but I'm unsure how to use that to create a distance between the page number displayed.

previous issue

I'll make a video of the problem and you can see it
https://youtu.be/1UlJlZWUcyM
when i next page is success,but i previous page 1 is wrong,i can't previous page 1,only previous page 2
how can i fix that?
thanks

Add option SHOW_FIRST_PAGE_WHEN_INVALID

It would be very useful to have an option to default to the first page if hitting a wrong page object.

I suggest to basically replace https://github.com/pydanny/dj-pagination/blob/master/dj_pagination/templatetags/pagination_tags.py#L186-L196 with something like this:

    try:
        page_obj = paginator.page(request.page(page_suffix))
    except InvalidPage:
        if INVALID_PAGE_RAISES_404:
            raise Http404(
                "Invalid page requested.  If DEBUG were set to "
                + "False, an HTTP 404 page would have been shown instead."
            )
        if SHOW_FIRST_PAGE_WHEN_INVALID
            # fallback to first page
            page_obj = paginator.page(1)
        else:
            context[key] = []
            context["invalid_page"] = True
            return ""

Django 1.10 compatibility

Hi Daniel! Good to see someone actively maintaining my go-to pagination package. One thing I've noticed - dj-pagination isn't yet compatible with 1.10, raising the following error:

TypeError: render_to_string() got an unexpected keyword argument 'context_instance'

which is expected since 1.10 removed that kwarg. I've sent a PR to zyga's repo, unfortunately it looks like it isn't maintained anymore.
I see you've already cleaned up Travis config, so how do you feel about code changes for 1.10? Do you want me to send a similar (but shorter) PR here?

When PAGINATION_DISABLE_LINK_FOR_FIRST_PAGE is True, the page 1 url links to the current page.

When PAGINATION_DISABLE_LINK_FOR_FIRST_PAGE is True, the href for the anchor tag for the number 1 page is blank. What this means is, when you click on the number 1, you just stay on the current page instead of going to page 1.

Look at this snippet of generated html. We are on page 4. If you hover over the number 1, the tooltip will show /current/path/?page=4. And, if you click on the number 1, nothing happens. You stay on the current page.

<div class="pagination">
  <a href="?page=3" class="prev">โ€นโ€น previous</a>
  <a href="" class="page">1</a>
  <a href="?page=2" class="page">2</a>
  <a href="?page=3" class="page">3</a>
  <span class="current page">4</span>
  <a href="?page=5" class="page">5</a>
  <a href="?page=6" class="page">6</a>
  ...
  <a href="?page=8585" class="page">8585</a>
  <a href="?page=8586" class="page">8586</a>
  <a href="?page=5" class="next">next โ€บโ€บ</a>
</div>

The problem is, the href for page 1 is blank. I think the bug is here, on line 25 of pagination.html.

{% if disable_link_for_first_page and page == 1 %}
<a href="{{ request.path }}{% if getvars %}?{{ getvars|slice:"1:" }}{% endif %}" class="page">{{ page }}</a>

I think there is another instance of the same problem on line 7 of pagination.html. When you are on page 2, the href for the anchor for the word "previous" is also blank. So if you are on page 2, and you click "previous", you stay on page 2.

Current setup_requires can cause Django 2.0 to install on Python 2

I maintain a few legacy Django projects which are not yet on Python 3 (don't worry, it's going to happen). The current setup_requires has caused Django 2.0 to attempt to install on these Python 2 installations when doing a pip install dj-pagination or even a pip install -r requirements.txt if Django 1.11.x is not already installed.

I've made a PR #14 which uses extras_require instead of setup_requires to enforce the conditional dependencies and ensure Django 2.0 does not install on Python 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.