mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-12-18 06:45:04 +01:00
[ADD] get_all_characters_from_user function to User API
This commit is contained in:
@@ -6,7 +6,7 @@ They are intended to be used in Alliance Auth itself as well as in the community
|
||||
These functions are intended to make the life of our community apps developer a little
|
||||
easier, so they don't have to reinvent the wheel all the time.
|
||||
|
||||
## Evecharacter API
|
||||
## EveCharacter API
|
||||
|
||||
### get_main_character_from_evecharacter
|
||||
|
||||
@@ -41,6 +41,22 @@ if the `EveCharacter` has no user.
|
||||
|
||||
## User API
|
||||
|
||||
### get_all_characters_from_user
|
||||
|
||||
This is to get all character objects (`EveCharacter`) of a user.
|
||||
|
||||
Given we have a `User` object called `my_user` and we want to get all characters:
|
||||
|
||||
```python
|
||||
# Alliance Auth
|
||||
from allianceauth.framework.api.user import get_all_characters_from_user
|
||||
|
||||
characters = get_all_characters_from_user(user=my_user)
|
||||
```
|
||||
|
||||
Now, `characters` is a `list` containing all `EveCharacter` objects of the user.
|
||||
If the user is `None`, an empty `list` will be returned.
|
||||
|
||||
### get_main_character_from_user
|
||||
|
||||
This is to get the main character object (`EveCharacter`) of a user.
|
||||
|
||||
Reference in New Issue
Block a user