Variable API Link for HR and Corpstats
Right now the setting only work with a jacknife instance. But what about SeAT?
Changing the setting to use fancy string formatting with parameters api_id
, vcode
, and pk
would allow the API link to be set to any of a jacknife install, a SeAT install, or the django admin site.
It's the same kind of thing as #597 (closed)
It would make the most sense to wait for SeAT integration, when all API keys are sent to it upon being entered, but for people running the allianceauth to seat script it would work beforehand.
Templates wouldn't be able to format this nicely, so we'd need a custom template tag to do it, perhaps something like {% api_link api %}
An example of its method would be:
def render_string(api):
return settings.API_LINK.format(pk=api.pk, api_id=api.api_id, vcode=api.api_key)
An example of the setting would be:
API_LINK = 'http://ridetheclown.com/eveapi/audit.php?usid={api_id}&apik={vcode} # jacknife
API_LINK = '/admin/eveonline/eveapikeypair/{api_id}/change/ # admin
API_LINK = 'http://seat.mydomain.com/api-key/detail/{api_id} # SeAT
All these kwargs are optional. So in theory the setting could even be left blank to not link anywhere.