跳转至

Django 设置

Bases: BaseModel

Alter these by modifying the values in Django's settings module (usually settings.py).

Attributes:

Name Type Description
NINJA_PAGINATION_CLASS str

The pagination class to use. Defaults to ninja.pagination.LimitOffsetPagination.

NINJA_PAGINATION_PER_PAGE int

The default page size. Defaults to 100.

NINJA_PAGINATION_MAX_LIMIT int

The maximum number of results per page. Defaults to inf.

Source code in ninja/conf.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class Settings(BaseModel):
    """
    Alter these by modifying the values in Django's settings module (usually
    `settings.py`).

    Attributes:
        NINJA_PAGINATION_CLASS (str):
            The pagination class to use. Defaults to
            `ninja.pagination.LimitOffsetPagination`.
        NINJA_PAGINATION_PER_PAGE (int):
            The default page size. Defaults to `100`.
        NINJA_PAGINATION_MAX_LIMIT (int):
            The maximum number of results per page. Defaults to `inf`.
    """

    PAGINATION_CLASS: str = Field(
        "ninja.pagination.LimitOffsetPagination", alias="NINJA_PAGINATION_CLASS"
    )
    PAGINATION_PER_PAGE: int = Field(100, alias="NINJA_PAGINATION_PER_PAGE")
    PAGINATION_MAX_LIMIT: int = Field(inf, alias="NINJA_PAGINATION_MAX_LIMIT")

    class Config:
        from_attributes = True

评论


本文总阅读量