mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Save the EVEAccount instance before attempting to add characters to it.
Since Django 1.2, the ORM needs to know what database the object belongs in before additions to their M2M fields. Saving the record before the character import solves the problem.
This commit is contained in:
@@ -72,14 +72,11 @@ def import_eve_account(api_key, user_id, force_cache=False):
|
|||||||
|
|
||||||
# Create or retrieve the account last to make sure everything
|
# Create or retrieve the account last to make sure everything
|
||||||
# before here is good to go.
|
# before here is good to go.
|
||||||
try:
|
account, created = EVEAccount.objects.get_or_create(id=user_id)
|
||||||
account = EVEAccount.objects.get(id=user_id)
|
|
||||||
except EVEAccount.DoesNotExist:
|
|
||||||
account = EVEAccount(id=user_id)
|
|
||||||
|
|
||||||
account.api_key = api_key
|
account.api_key = api_key
|
||||||
account.api_user_id = user_id
|
account.api_user_id = user_id
|
||||||
account.api_status = API_STATUS_OK
|
account.api_status = API_STATUS_OK
|
||||||
|
account.save()
|
||||||
|
|
||||||
for node in characters_node_children:
|
for node in characters_node_children:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user