1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
| from django.contrib import admin
|
| from .models import ModelProviderConnection
|
|
| @admin.register(ModelProviderConnection)
| class ModelProviderConnectionAdmin(admin.ModelAdmin):
| list_display = (
| 'provider',
| 'scope',
| 'organization',
| 'created_by',
| 'created_at',
| 'updated_at',
| 'is_internal',
| )
| list_filter = ('provider', 'scope', 'is_internal')
| search_fields = ('provider', 'deployment_name', 'endpoint')
| readonly_fields = ('created_at', 'updated_at', 'budget_total_spent')
| fieldsets = (
| (
| 'Provider Details',
| {
| 'fields': (
| 'provider',
| 'api_key',
| 'auth_token',
| 'deployment_name',
| 'endpoint',
| )
| },
| ),
| (
| 'Google Cloud Details',
| {
| 'fields': (
| 'google_application_credentials',
| 'google_project_id',
| 'google_location',
| ),
| 'classes': ('collapse',),
| },
| ),
| (
| 'Scope and Organization',
| {'fields': ('scope', 'organization', 'created_by', 'is_internal')},
| ),
| (
| 'Budget Settings',
| {
| 'fields': (
| 'budget_limit',
| 'budget_last_reset_date',
| 'budget_reset_period',
| 'budget_total_spent',
| 'budget_alert_threshold',
| )
| },
| ),
| ('Timestamps', {'fields': ('created_at', 'updated_at')}),
| )
|
|