This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
from typing import Type | |
from rest_framework import filters | |
from django.db.models.query import QuerySet | |
from django.http.request import HttpRequest | |
from django.views import View |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
from typing import Optional, Type | |
from django.db.models import Model | |
class NestedObject: | |
requires_context = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Callable, List, ClassVar, Union | |
from rest_framework.views import APIView | |
# Inspired on https://stackoverflow.com/q/64185352 | |
def auto_schema_once(*, names: Union[List[str], str], decorator: Callable, schemas: dict) -> Callable: | |
if names == "__all__": | |
names = ["create", "list", "retrieve", "destroy", "update", "partial_update"] | |
def _decorator(cls: ClassVar[APIView]) -> ClassVar[APIView]: |