Skip to content

Commit c9a55ad

Browse files
committed
docs: minor update
1 parent 949ced8 commit c9a55ad

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

easy/controller/base.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff 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
...

easy/controller/meta.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -218,23 +218,7 @@ async def patch_obj( # type: ignore
218218
class 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(

0 commit comments

Comments
 (0)