mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-22 14:19:28 +00:00
Correct longstanding issues with the EVEAccount object regarding its primary key
This commit is contained in:
@@ -79,7 +79,7 @@ def import_apikey_func(api_userid, api_key, user=None, force_cache=False, log=lo
|
||||
# Checks for a document error
|
||||
if 'error' in doc:
|
||||
try:
|
||||
account = EVEAccount.objects.get(id=api_userid)
|
||||
account = EVEAccount.objects.get(api_user_id=api_userid)
|
||||
except EVEAccount.DoesNotExist:
|
||||
# If no Account exists in the DB, just ignore it
|
||||
return
|
||||
@@ -102,7 +102,7 @@ def import_apikey_func(api_userid, api_key, user=None, force_cache=False, log=lo
|
||||
|
||||
# Create or retrieve the account last to make sure everything
|
||||
# before here is good to go.
|
||||
account, created = EVEAccount.objects.get_or_create(id=api_userid, api_user_id=api_userid)
|
||||
account, created = EVEAccount.objects.get_or_create(api_user_id=api_userid, api_user_id=api_userid)
|
||||
account.api_key = api_key
|
||||
account.api_status = API_STATUS_OK
|
||||
if user and created:
|
||||
|
||||
@@ -155,7 +155,7 @@ def import_eve_character_func(character_id, api_key=None, user_id=None, logger=l
|
||||
pchar.save()
|
||||
|
||||
try:
|
||||
acc = EVEAccount.objects.get(api_user_id=user_id)
|
||||
acc = EVEAccount.objects.get(pk=user_id)
|
||||
if not pchar.id in acc.characters.all().values_list('id', flat=True):
|
||||
acc.characters.add(pchar)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user