Giter Site home page Giter Site logo

Comments (3)

eamigo86 avatar eamigo86 commented on August 13, 2024 1

Hi @basilfx, I will work to make the configuration of the page more friendly, in the next days I will update the module with the changes and I will let you know.
Thanks for the suggestions that will always be welcome. regards

from graphene-django-extras.

basilfx avatar basilfx commented on August 13, 2024 1

Tested the new option, and it works like a charm. I did not use the settings in settings.py, but just in the constructor itself.

from graphene-django-extras.

eamigo86 avatar eamigo86 commented on August 13, 2024

Hi @basilfx, I have uploaded a new version (0.0.1rc2) with the possibility of choosing the pagination type and the number of elements of each page in a global way in the settings.py, I still have to update the documentation (I'm lazy doing it), but in essence it can be configured like this:

GRAPHENE_DJANGO_EXTRAS = {
    # Default Pagination: None
    'DEFAULT_PAGINATION_CLASS': "graphene_django_extras.pagination.LimitOffsetGraphqlPagination",

    # Default: None
    'PAGE_SIZE':  100,
}

Regardless of pagination type, you will see in the parameter description the values of the default limits and the maximum limit of the each page size, example (LimitOffsetGraphqlPagination):
image

These parameters can be configured by specifying the pagination in each DjangoObjectListType:
image

In this case (LimitOffsetGraphqlPagination), if the max_limit value is not specified when defining the pagination type in the DjangoObjectListType definition, the request can be made without limit size, but if a max_limit or a default_limit is not specified and a PAGE_SIZE is not specified in setting.py, the query will return None, just as it happens in the DjangoRestFramework module.

Similarly if you try to set a limit that is greater than the defined max_limit or not specify at all, the size of the paginate will be the value of max_limit specified in DjangoObjectListType definition (in this case: max 6 users):
image

A similar configuration works with PageGraphqlPagination, but instead of max_limit and default_limit, you should use: page_size and max_page_size.

It is difficult to return the actual limit (page size) that is used to the request as you suggested, I will continue to look for an optimal way to give that possibility, for now this is everything.

from graphene-django-extras.

Related Issues (20)

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.