From ab9873abedc0c411622657aa8f2ddcf3b9b3dbd4 Mon Sep 17 00:00:00 2001 From: ChristopherJHart Date: Fri, 19 May 2023 05:41:11 -0400 Subject: [PATCH] docs: fix foreign key bullet list formatting (#1079) Co-authored-by: collerek --- docs/relations/foreign-key.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/relations/foreign-key.md b/docs/relations/foreign-key.md index de4e90a..6cd0536 100644 --- a/docs/relations/foreign-key.md +++ b/docs/relations/foreign-key.md @@ -32,19 +32,21 @@ Reverse relation exposes API to manage related objects also from parent side. ### Skipping reverse relation -If you are sure you don't want the reverse relation you can use `skip_reverse=True` +If you are sure you don't want the reverse relation you can use `skip_reverse=True` flag of the `ForeignKey`. - If you set `skip_reverse` flag internally the field is still registered on the other - side of the relationship so you can: - * `filter` by related models fields from reverse model - * `order_by` by related models fields from reverse model +If you set `skip_reverse` flag internally the field is still registered on the other +side of the relationship so you can: + +* `filter` by related models fields from reverse model +* `order_by` by related models fields from reverse model - But you cannot: - * access the related field from reverse model with `related_name` - * even if you `select_related` from reverse side of the model the returned models won't be populated in reversed instance (the join is not prevented so you still can `filter` and `order_by` over the relation) - * the relation won't be populated in `dict()` and `json()` - * you cannot pass the nested related objects when populating from dictionary or json (also through `fastapi`). It will be either ignored or error will be raised depending on `extra` setting in pydantic `Config`. +But you cannot: + +* Access the related field from reverse model with `related_name` +* Even if you `select_related` from reverse side of the model the returned models won't be populated in reversed instance (the join is not prevented so you still can `filter` and `order_by` over the relation) +* The relation won't be populated in `dict()` and `json()` +* You cannot pass the nested related objects when populating from dictionary or json (also through `fastapi`). It will be either ignored or error will be raised depending on `extra` setting in pydantic `Config`. Example: