mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2026-03-13 07:49:55 +08:00
Fix code highlights
This commit is contained in:
@@ -21,7 +21,7 @@ We are providing a base model with those fields for each database we are support
|
||||
|
||||
We'll expand from the basic SQLAlchemy configuration.
|
||||
|
||||
```py hl_lines="5 19-20 41-42"
|
||||
```py hl_lines="5-8 21-22 43-46"
|
||||
--8<-- "docs/src/db_sqlalchemy_access_tokens.py"
|
||||
```
|
||||
|
||||
@@ -47,7 +47,7 @@ We'll expand from the basic SQLAlchemy configuration.
|
||||
|
||||
We'll expand from the basic Beanie configuration.
|
||||
|
||||
```py hl_lines="4 17-18 25-26"
|
||||
```py hl_lines="4-7 20-21 28-29"
|
||||
--8<-- "docs/src/db_beanie_access_tokens.py"
|
||||
```
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ For the sake of this tutorial from now on, we'll use a simple SQLite databse.
|
||||
|
||||
As for any SQLAlchemy ORM model, we'll create a `User` model.
|
||||
|
||||
```py hl_lines="14-15"
|
||||
```py hl_lines="13-14"
|
||||
--8<-- "docs/src/db_sqlalchemy.py"
|
||||
```
|
||||
|
||||
@@ -35,7 +35,7 @@ As you can see, **FastAPI Users** provides a base class that will include base f
|
||||
|
||||
We'll now create an utility function to create all the defined tables.
|
||||
|
||||
```py hl_lines="22-24"
|
||||
```py hl_lines="21-23"
|
||||
--8<-- "docs/src/db_sqlalchemy.py"
|
||||
```
|
||||
|
||||
@@ -48,7 +48,7 @@ This function can be called, for example, during the initialization of your Fast
|
||||
|
||||
The database adapter of **FastAPI Users** makes the link between your database configuration and the users logic. It should be generated by a FastAPI dependency.
|
||||
|
||||
```py hl_lines="27-33"
|
||||
```py hl_lines="26-33"
|
||||
--8<-- "docs/src/db_sqlalchemy.py"
|
||||
```
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ It's designed to be easily extensible and customizable so that you can integrate
|
||||
|
||||
You should define your own version of the `UserManager` class to set various parameters.
|
||||
|
||||
```py hl_lines="13-28"
|
||||
```py hl_lines="12-27"
|
||||
--8<-- "docs/src/user_manager.py"
|
||||
```
|
||||
|
||||
@@ -57,7 +57,7 @@ class UserManager(BaseUserManager[User, MyCustomID]):
|
||||
|
||||
The `UserManager` class will be injected at runtime using a FastAPI dependency. This way, you can run it in a database session or swap it with a mock during testing.
|
||||
|
||||
```py hl_lines="31-32"
|
||||
```py hl_lines="30-31"
|
||||
--8<-- "docs/src/user_manager.py"
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user