@@ -54,23 +54,35 @@ class Field:
54
54
default_validators : List [Callable ] = ...
55
55
default_empty_html : Any = ...
56
56
initial : Optional [Any ] = ...
57
+ read_only : bool = ...
58
+ write_only : bool = ...
59
+ required : bool = ...
60
+ default : Any = ...
61
+ initial : Any = ...
62
+ source : Optional [str ] = ...
63
+ label : Optional [str ] = ...
64
+ help_text : Optional [str ] = ...
65
+ style : Optional [Mapping [str , Any ]] = ...
66
+ error_messages : Optional [Mapping [str , str ]] = ...
67
+ validators : Optional [List [_Validator ]] = ...
68
+ allow_null : bool = ...
69
+ field_name : Optional [str ] = ...
57
70
# TODO: add Generic/Plugin support for parent
58
- parent : Optional [Any ]
59
- validators : Optional [List [_Validator ]]
71
+ parent : Optional [Any ] = ...
60
72
def __init__ (
61
73
self ,
62
74
read_only : bool = ...,
63
75
write_only : bool = ...,
64
76
required : bool = ...,
65
77
default : Any = ...,
66
78
initial : Any = ...,
67
- source : Union [ Callable , str ] = ...,
79
+ source : Optional [ str ] = ...,
68
80
label : Optional [str ] = ...,
69
81
help_text : str = ...,
70
- allow_null : bool = ...,
71
- validators : Optional [Sequence [_Validator ]] = ...,
72
- error_messages : Optional [Mapping [str , str ]] = ...,
73
82
style : Optional [Mapping [str , Any ]] = ...,
83
+ error_messages : Optional [Mapping [str , str ]] = ...,
84
+ validators : Optional [Sequence [_Validator ]] = ...,
85
+ allow_null : bool = ...,
74
86
): ...
75
87
def bind (self , field_name : str , parent : BaseSerializer ) -> None : ...
76
88
def get_validators (self ) -> List [Callable ]: ...
@@ -102,14 +114,15 @@ class NullBooleanField(Field):
102
114
class CharField (Field ):
103
115
_pyi_field_actual_type : str
104
116
_pyi_field_primitive_type : str
117
+ allow_blank : bool = ...
105
118
def __init__ (
106
119
self ,
107
120
read_only : bool = ...,
108
121
write_only : bool = ...,
109
122
required : bool = ...,
110
123
default : Any = ...,
111
124
initial : Any = ...,
112
- source : Union [ Callable , str ] = ...,
125
+ source : Optional [ str ] = ...,
113
126
label : Optional [str ] = ...,
114
127
help_text : str = ...,
115
128
allow_null : bool = ...,
@@ -133,7 +146,7 @@ class RegexField(CharField):
133
146
required : bool = ...,
134
147
default : Any = ...,
135
148
initial : Any = ...,
136
- source : Union [ Callable , str ] = ...,
149
+ source : Optional [ str ] = ...,
137
150
label : Optional [str ] = ...,
138
151
help_text : str = ...,
139
152
allow_null : bool = ...,
@@ -155,7 +168,7 @@ class SlugField(CharField):
155
168
required : bool = ...,
156
169
default : Any = ...,
157
170
initial : Any = ...,
158
- source : Union [ Callable , str ] = ...,
171
+ source : Optional [ str ] = ...,
159
172
label : Optional [str ] = ...,
160
173
help_text : str = ...,
161
174
allow_null : bool = ...,
@@ -183,7 +196,7 @@ class UUIDField(Field):
183
196
required : bool = ...,
184
197
default : Any = ...,
185
198
initial : Any = ...,
186
- source : Union [ Callable , str ] = ...,
199
+ source : Optional [ str ] = ...,
187
200
label : Optional [str ] = ...,
188
201
help_text : str = ...,
189
202
allow_null : bool = ...,
@@ -201,7 +214,7 @@ class IPAddressField(CharField):
201
214
required : bool = ...,
202
215
default : Any = ...,
203
216
initial : Any = ...,
204
- source : Union [ Callable , str ] = ...,
217
+ source : Optional [ str ] = ...,
205
218
label : Optional [str ] = ...,
206
219
help_text : str = ...,
207
220
allow_null : bool = ...,
@@ -229,7 +242,7 @@ class IntegerField(Field):
229
242
required : bool = ...,
230
243
default : Any = ...,
231
244
initial : Any = ...,
232
- source : Union [ Callable , str ] = ...,
245
+ source : Optional [ str ] = ...,
233
246
label : Optional [str ] = ...,
234
247
help_text : str = ...,
235
248
allow_null : bool = ...,
@@ -252,7 +265,7 @@ class FloatField(Field):
252
265
required : bool = ...,
253
266
default : Any = ...,
254
267
initial : Any = ...,
255
- source : Union [ Callable , str ] = ...,
268
+ source : Optional [ str ] = ...,
256
269
label : Optional [str ] = ...,
257
270
help_text : str = ...,
258
271
allow_null : bool = ...,
@@ -277,7 +290,7 @@ class DecimalField(Field):
277
290
required : bool = ...,
278
291
default : Any = ...,
279
292
initial : Any = ...,
280
- source : Union [ Callable , str ] = ...,
293
+ source : Optional [ str ] = ...,
281
294
label : Optional [str ] = ...,
282
295
help_text : str = ...,
283
296
allow_null : bool = ...,
@@ -303,7 +316,7 @@ class DateTimeField(Field):
303
316
required : bool = ...,
304
317
default : Any = ...,
305
318
initial : Any = ...,
306
- source : Union [ Callable , str ] = ...,
319
+ source : Optional [ str ] = ...,
307
320
label : Optional [str ] = ...,
308
321
help_text : str = ...,
309
322
allow_null : bool = ...,
@@ -328,7 +341,7 @@ class DateField(Field):
328
341
required : bool = ...,
329
342
default : Any = ...,
330
343
initial : Any = ...,
331
- source : Union [ Callable , str ] = ...,
344
+ source : Optional [ str ] = ...,
332
345
label : Optional [str ] = ...,
333
346
help_text : str = ...,
334
347
allow_null : bool = ...,
@@ -351,7 +364,7 @@ class TimeField(Field):
351
364
required : bool = ...,
352
365
default : Any = ...,
353
366
initial : Any = ...,
354
- source : Union [ Callable , str ] = ...,
367
+ source : Optional [ str ] = ...,
355
368
label : Optional [str ] = ...,
356
369
help_text : str = ...,
357
370
allow_null : bool = ...,
@@ -372,7 +385,7 @@ class DurationField(Field):
372
385
required : bool = ...,
373
386
default : Any = ...,
374
387
initial : Any = ...,
375
- source : Union [ Callable , str ] = ...,
388
+ source : Optional [ str ] = ...,
376
389
label : Optional [str ] = ...,
377
390
help_text : str = ...,
378
391
allow_null : bool = ...,
@@ -387,6 +400,7 @@ class ChoiceField(Field):
387
400
choices : Sequence [Any ]
388
401
html_cutoff : Optional [int ] = ...
389
402
html_cutoff_text : Optional [str ] = ...
403
+ allow_blank : bool = ...
390
404
def __init__ (
391
405
self ,
392
406
choices : Sequence [Any ],
@@ -398,7 +412,7 @@ class ChoiceField(Field):
398
412
required : bool = ...,
399
413
default : Any = ...,
400
414
initial : Any = ...,
401
- source : Union [ Callable , str ] = ...,
415
+ source : Optional [ str ] = ...,
402
416
label : Optional [str ] = ...,
403
417
help_text : str = ...,
404
418
allow_null : bool = ...,
@@ -411,6 +425,7 @@ class ChoiceField(Field):
411
425
def _set_choices (self , choices : Sequence [Any ]) -> None : ...
412
426
413
427
class MultipleChoiceField (ChoiceField ):
428
+ allow_empty : bool = ...
414
429
def __init__ (
415
430
self ,
416
431
choices : Sequence [Any ],
@@ -423,7 +438,7 @@ class MultipleChoiceField(ChoiceField):
423
438
required : bool = ...,
424
439
default : Any = ...,
425
440
initial : Any = ...,
426
- source : Union [ Callable , str ] = ...,
441
+ source : Optional [ str ] = ...,
427
442
label : Optional [str ] = ...,
428
443
help_text : str = ...,
429
444
allow_null : bool = ...,
@@ -446,7 +461,7 @@ class FilePathField(ChoiceField):
446
461
required : Optional [bool ] = ...,
447
462
default : Any = ...,
448
463
initial : Any = ...,
449
- source : Union [ Callable , str ] = ...,
464
+ source : Optional [ str ] = ...,
450
465
label : Optional [str ] = ...,
451
466
help_text : str = ...,
452
467
allow_null : bool = ...,
@@ -468,7 +483,7 @@ class FileField(Field):
468
483
required : bool = ...,
469
484
default : Any = ...,
470
485
initial : Any = ...,
471
- source : Union [ Callable , str ] = ...,
486
+ source : Optional [ str ] = ...,
472
487
label : Optional [str ] = ...,
473
488
help_text : str = ...,
474
489
allow_null : bool = ...,
@@ -482,6 +497,7 @@ class SupportsToPython(Protocol):
482
497
483
498
class ImageField (FileField ):
484
499
_DjangoImageField : SupportsToPython
500
+ allow_empty : bool = ...
485
501
def __init__ (
486
502
self ,
487
503
_DjangoImageField : Type [SupportsToPython ] = ...,
@@ -493,7 +509,7 @@ class ImageField(FileField):
493
509
required : bool = ...,
494
510
default : Any = ...,
495
511
initial : Any = ...,
496
- source : Union [ Callable , str ] = ...,
512
+ source : Optional [ str ] = ...,
497
513
label : Optional [str ] = ...,
498
514
help_text : str = ...,
499
515
allow_null : bool = ...,
@@ -520,7 +536,7 @@ class ListField(Field):
520
536
required : bool = ...,
521
537
default : Any = ...,
522
538
initial : Any = ...,
523
- source : Union [ Callable , str ] = ...,
539
+ source : Optional [ str ] = ...,
524
540
label : Optional [str ] = ...,
525
541
help_text : str = ...,
526
542
allow_null : bool = ...,
@@ -540,7 +556,7 @@ class DictField(Field):
540
556
required : bool = ...,
541
557
default : Any = ...,
542
558
initial : Any = ...,
543
- source : Union [ Callable , str ] = ...,
559
+ source : Optional [ str ] = ...,
544
560
label : Optional [str ] = ...,
545
561
help_text : str = ...,
546
562
allow_null : bool = ...,
@@ -562,7 +578,7 @@ class JSONField(Field):
562
578
required : bool = ...,
563
579
default : Any = ...,
564
580
initial : Any = ...,
565
- source : Union [ Callable , str ] = ...,
581
+ source : Optional [ str ] = ...,
566
582
label : Optional [str ] = ...,
567
583
help_text : str = ...,
568
584
allow_null : bool = ...,
@@ -584,7 +600,7 @@ class SerializerMethodField(Field):
584
600
required : bool = ...,
585
601
default : Any = ...,
586
602
initial : Any = ...,
587
- source : Union [ Callable , str ] = ...,
603
+ source : Optional [ str ] = ...,
588
604
label : Optional [str ] = ...,
589
605
help_text : str = ...,
590
606
allow_null : bool = ...,
@@ -604,7 +620,7 @@ class ModelField(Field):
604
620
required : bool = ...,
605
621
default : Any = ...,
606
622
initial : Any = ...,
607
- source : Union [ Callable , str ] = ...,
623
+ source : Optional [ str ] = ...,
608
624
label : Optional [str ] = ...,
609
625
help_text : str = ...,
610
626
allow_null : bool = ...,
0 commit comments