Skip to content

Add CurrentUserDefault #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions rest_framework-stubs/fields.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ from typing import (
MutableMapping,
)

from django.contrib.auth.models import AnonymousUser, User
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Model
Expand All @@ -39,6 +40,10 @@ class CreateOnlyDefault(object):
def set_context(self, serializer_field: Field) -> None: ...
def __call__(self) -> Any: ...

class CurrentUserDefault(object):
def set_context(self, serializer_field: Field) -> None: ...
def __call__(self) -> Union[AnonymousUser, User]: ...

class SkipField(Exception): ...

def set_value(dictionary: MutableMapping[str, Any], keys: Sequence[str], value: Any) -> None: ...
Expand Down
1 change: 1 addition & 0 deletions rest_framework-stubs/serializers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ from rest_framework.fields import (
ImageField as ImageField,
SkipField as SkipField,
CreateOnlyDefault as CreateOnlyDefault,
CurrentUserDefault as CurrentUserDefault,
)
from rest_framework.exceptions import (
APIException as APIException,
Expand Down