website/docs: added example for custom user attributes (#2406)
* added example for custom user attributes * simplified example Co-authored-by: croudsarabi <constantin.roudsarabi@andrena.de>
This commit is contained in:
parent
b7a6fccdf9
commit
0f56d00959
|
@ -0,0 +1,9 @@
|
|||
- `user`: The current user. This may be `None` if there is no contextual user. See ([User](../user-group/user.md#object-attributes))
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
return {
|
||||
"custom_attribute": request.user.attributes.get("custom_attribute", "default"),
|
||||
}
|
||||
```
|
|
@ -17,6 +17,9 @@ import Objects from '../expressions/_objects.md'
|
|||
|
||||
<Objects />
|
||||
|
||||
- `user`: The current user. This may be `None` if there is no contextual user. See ([User](../user-group/user.md#object-attributes))
|
||||
import User from '../expressions/_user.md'
|
||||
|
||||
<User />
|
||||
|
||||
- `request`: The current request. This may be `None` if there is no contextual request. See ([Django documentation](https://docs.djangoproject.com/en/3.0/ref/request-response/#httprequest-objects))
|
||||
- Other arbitrary arguments given by the provider, this is documented on the Provider/Source.
|
||||
|
|
Reference in New Issue