Files
fastapi-users/docs/configuration/model.md
prostomarkeloff b5b0bbbb01 Tortoise ORM support (#59)
* add tortoise to dependencies

* add tortoise as optional dependency in pyproject.toml

* add tortoise support (tests needed)

* Add tortoise support (also defined orm_mode in pydantic model

* tests for tortoise support

* format by black

* docs for tortoise

* delete type annotations

* delete underscore

* do it in 1 line

* add 1 line before yield

* fix in docs

* fix bug and add annotation for test

* Tweak documentation and fix Tortoise error about id update

* Improve Tortoise coverage by using get instead of filter

* Fix Pipfile.lock
2019-12-03 21:24:27 +01:00

33 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# User model
**FastAPI Users** defines a minimal User model for authentication purposes. It is structured like this:
* `id` (`str`) Unique identifier of the user. Default to a **UUID4**.
* `email` (`str`) Email of the user. Validated by [`email-validator`](https://github.com/JoshData/python-email-validator).
* `is_active` (`bool`) Whether or not the user is active. If not, login and forgot password requests will be denied. Default to `True`.
* `is_active` (`bool`) Whether or not the user is a superuser. Useful to implement administration logic. Default to `False`.
## Use the model
The model is exposed as a Pydantic model mixin.
```py
from fastapi_users import BaseUser
class User(BaseUser):
pass
```
You can of course add you own properties there to fit to your needs!
## Next steps
Depending on your database backend, database configuration will differ a bit.
[I'm using SQLAlchemy](databases/sqlalchemy.md)
[I'm using MongoDB](databases/mongodb.md)
[I'm using Tortoise ORM](databases/tortoise.md)