mirror of
https://github.com/nikdoof/test-auth.git
synced 2026-01-31 00:18:14 +00:00
Fix a few asumptions not fixed in the last commit
This commit is contained in:
@@ -22,8 +22,8 @@ def char_api_update(modeladmin, request, queryset):
|
|||||||
char_api_update.short_description = "Update character information from the EVE API"
|
char_api_update.short_description = "Update character information from the EVE API"
|
||||||
|
|
||||||
class EVEAccountAdmin(admin.ModelAdmin):
|
class EVEAccountAdmin(admin.ModelAdmin):
|
||||||
list_display = ('id', 'user', 'api_keytype', 'api_status', 'api_last_updated')
|
list_display = ('api_user_id', 'user', 'api_keytype', 'api_status', 'api_last_updated')
|
||||||
search_fields = ['id', 'user__username']
|
search_fields = ['api_user_id', 'user__username']
|
||||||
readonly_fields = ('api_keytype', 'api_user_id', 'api_key', 'api_status', 'characters', 'api_last_updated', 'characters')
|
readonly_fields = ('api_keytype', 'api_user_id', 'api_key', 'api_status', 'characters', 'api_last_updated', 'characters')
|
||||||
actions = [account_api_update]
|
actions = [account_api_update]
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class EVEAccount(EVEAPIModel):
|
|||||||
help_text="Type of API key")
|
help_text="Type of API key")
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u"%s" % self.id
|
return u"%s" % self.pk
|
||||||
|
|
||||||
def in_corp(self, corpid):
|
def in_corp(self, corpid):
|
||||||
return self.character.filter(corporation__id=corpid).count()
|
return self.character.filter(corporation__id=corpid).count()
|
||||||
|
|||||||
@@ -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
|
# Create or retrieve the account last to make sure everything
|
||||||
# before here is good to go.
|
# before here is good to go.
|
||||||
account, created = EVEAccount.objects.get_or_create(api_user_id=api_userid, api_user_id=api_userid)
|
account, created = EVEAccount.objects.get_or_create(api_key=api_key, api_user_id=api_userid)
|
||||||
account.api_key = api_key
|
account.api_key = api_key
|
||||||
account.api_status = API_STATUS_OK
|
account.api_status = API_STATUS_OK
|
||||||
if user and created:
|
if user and created:
|
||||||
|
|||||||
Reference in New Issue
Block a user