admin: show the URL to configure in hobo
gitea/ants-hub/pipeline/head There was a failure building this commit
Details
gitea/ants-hub/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
19ba7ed034
commit
f09f0b1ef7
|
@ -4,6 +4,7 @@ import django.contrib.admin.options
|
|||
import django.contrib.admin.widgets
|
||||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
from django.utils.html import format_html
|
||||
|
||||
from ants_hub.admin import site
|
||||
|
||||
|
@ -22,14 +23,15 @@ class ConfigAdmin(UneditableMixin, admin.ModelAdmin):
|
|||
|
||||
|
||||
class RaccordementAdmin(admin.ModelAdmin):
|
||||
list_display = ['name', 'short_apikey', 'created', 'last_update']
|
||||
list_display = ['name', 'chrono_url', 'last_update']
|
||||
search_fields = ['name', 'apikey', 'notes']
|
||||
ordering = ['name']
|
||||
|
||||
def short_apikey(self, instance):
|
||||
return instance.apikey[:4] + '…'
|
||||
def chrono_url(self, instance):
|
||||
url = settings.ANTS_HUB_API_URL % instance.apikey
|
||||
return format_html('<a href="{0}">{0}</a>', url)
|
||||
|
||||
short_apikey.short_description = 'API key'
|
||||
chrono_url.short_description = 'SETTING_CHRONO_ANTS_HUB_URL'
|
||||
|
||||
|
||||
class CollectiviteAdmin(UneditableMixin, admin.ModelAdmin):
|
||||
|
|
|
@ -113,6 +113,9 @@ ANTS_HUB_X_HUB_RDV_AUTH_TOKEN = None
|
|||
# ANTS_HUB_ADMIN_ROLE
|
||||
ANTS_HUB_ADMIN_ROLE = None
|
||||
|
||||
# ANTS_HUB_API_URL
|
||||
ANTS_HUB_API_URL = 'https://%s:@ants-hub.entrouvert.org/api/chrono/'
|
||||
|
||||
|
||||
if 'ANTS_HUB_SETTINGS_FILE' in os.environ:
|
||||
with open(os.environ['ANTS_HUB_SETTINGS_FILE']) as fd:
|
||||
|
|
Loading…
Reference in New Issue