Skip to content

Commit c0e28ce

Browse files
committed
Added CurrentUserDefault.
1 parent 27afc14 commit c0e28ce

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

rest_framework-stubs/fields.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ from typing import (
2222
MutableMapping,
2323
)
2424

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

43+
class CurrentUserDefault(object):
44+
def set_context(self, serializer_field: Field) -> None: ...
45+
def __call__(self) -> Union[AnonymousUser, User]: ...
46+
4247
class SkipField(Exception): ...
4348

4449
def set_value(dictionary: MutableMapping[str, Any], keys: Sequence[str], value: Any) -> None: ...

rest_framework-stubs/serializers.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ from rest_framework.fields import (
4747
ImageField as ImageField,
4848
SkipField as SkipField,
4949
CreateOnlyDefault as CreateOnlyDefault,
50+
CurrentUserDefault as CurrentUserDefault,
5051
)
5152
from rest_framework.exceptions import (
5253
APIException as APIException,

0 commit comments

Comments
 (0)