Fix a few asumptions not fixed in the last commit

This commit is contained in:
2011-05-19 16:13:17 +01:00
parent d1afc15fc0
commit fe95eb2d21
3 changed files with 4 additions and 4 deletions

View File

@@ -22,8 +22,8 @@ def char_api_update(modeladmin, request, queryset):
char_api_update.short_description = "Update character information from the EVE API"
class EVEAccountAdmin(admin.ModelAdmin):
list_display = ('id', 'user', 'api_keytype', 'api_status', 'api_last_updated')
search_fields = ['id', 'user__username']
list_display = ('api_user_id', 'user', 'api_keytype', 'api_status', 'api_last_updated')
search_fields = ['api_user_id', 'user__username']
readonly_fields = ('api_keytype', 'api_user_id', 'api_key', 'api_status', 'characters', 'api_last_updated', 'characters')
actions = [account_api_update]

View File

@@ -28,7 +28,7 @@ class EVEAccount(EVEAPIModel):
help_text="Type of API key")
def __unicode__(self):
return u"%s" % self.id
return u"%s" % self.pk
def in_corp(self, corpid):
return self.character.filter(corporation__id=corpid).count()

View File

@@ -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(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_status = API_STATUS_OK
if user and created: