mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-16 07:50:16 +02:00
Prevent admin error when EveCharacter has no assigned user.
This commit is contained in:
parent
b4dc624b17
commit
97743cfe16
@ -22,12 +22,13 @@ class EveCharacterAdmin(admin.ModelAdmin):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def main_character(obj):
|
def main_character(obj):
|
||||||
auth = AuthServicesInfo.objects.get_or_create(user=obj.user)[0]
|
if obj.user:
|
||||||
if auth and auth.main_char_id:
|
auth = AuthServicesInfo.objects.get_or_create(user=obj.user)[0]
|
||||||
try:
|
if auth and auth.main_char_id:
|
||||||
return EveCharacter.objects.get(character_id=auth.main_char_id)
|
try:
|
||||||
except EveCharacter.DoesNotExist:
|
return EveCharacter.objects.get(character_id=auth.main_char_id)
|
||||||
pass
|
except EveCharacter.DoesNotExist:
|
||||||
|
pass
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user