File tree Expand file tree Collapse file tree 2 files changed +13
-18
lines changed Expand file tree Collapse file tree 2 files changed +13
-18
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,22 @@ class CrudAPIController(metaclass=CrudApiMetaclass):
2424
2525 Configuration:
2626 model: django model
27+ generate_crud: whether to create crud api, default to True
28+ model_exclude: fields to be excluded in Schema, it will ignore model_fields
2729 model_fields: fields to be included in Schema, default to "__all__"
28- model_exclude: fields to be excluded in Schema
2930 model_join: retrieve all m2m fields, default to True
3031 model_recursive: recursively retrieve FK/OneToOne models, default to False
3132 sensitive_fields: fields to be ignored
33+
34+ Example:
35+ class Meta
36+ model = Event
37+ generate_crud = False
38+ model_exclude = ["field1", "field2"]
39+ model_fields = ["field1", "field2"]
40+ model_join = False
41+ model_recursive = True
42+ sensitive_fields = ["token", "money"]
3243 """
3344
3445 ...
Original file line number Diff line number Diff line change @@ -218,23 +218,7 @@ async def patch_obj( # type: ignore
218218class ModelOptions :
219219 def __init__ (self , options : object = None ):
220220 """
221- Configuration:
222- model: django model
223- generate_crud: whether to create crud api, default to True
224- model_exclude: fields to be excluded in Schema, it will ignore model_fields
225- model_fields: fields to be included in Schema, default to "__all__"
226- model_join: retrieve all m2m fields, default to True
227- model_recursive: recursively retrieve FK/OneToOne models, default to False
228- sensitive_fields: fields to be ignored
229- Example:
230- class Meta
231- model = Event
232- generate_crud = False
233- model_exclude = ["field1", "field2"]
234- model_fields = ["field1", "field2"]
235- model_join = False
236- model_recursive = True
237- sensitive_fields = ["token", "money"]
221+ Configuration reader
238222 """
239223 self .model : Optional [Type [models .Model ]] = getattr (options , "model" , None )
240224 self .generate_crud : Optional [Union [bool ]] = getattr (
You can’t perform that action at this time.
0 commit comments