|
@@ -81,6 +81,7 @@ class AllocationInline(admin.TabularInline):
|
|
|
fields = ('id', 'service', 'resource', 'route', 'start', 'end')
|
|
|
raw_id_fields = ('service', 'resource',)
|
|
|
verbose_name_plural = 'Allocations'
|
|
|
+ show_change_link = True
|
|
|
|
|
|
def get_max_num(self, request, obj=None, **kwargs):
|
|
|
existing = obj.allocations.count() if obj else 0
|
|
@@ -102,12 +103,15 @@ ends_resource.short_description = 'Terminer les allocations sélectionnées'
|
|
|
### ModelAdmin
|
|
|
|
|
|
class ServiceAdmin(admin.ModelAdmin):
|
|
|
- list_display = ('id', 'adhesion', 'service_type', 'label', 'active')
|
|
|
+ list_display = ('id', 'adhesion_link', 'service_type', 'label', 'active')
|
|
|
list_filter = ('active', ServiceTypeFilter,)
|
|
|
inlines = (AllocationInline,)
|
|
|
search_fields = ('id', 'service_type__name', 'label')
|
|
|
raw_id_fields = ('adhesion',)
|
|
|
|
|
|
+ adhesion_link = get_foreignkey_link_func('adhesion')
|
|
|
+ adhesion_link.short_description = 'Numéro d’adhésion'
|
|
|
+
|
|
|
def get_actions(self, request):
|
|
|
actions = super().get_actions(request)
|
|
|
if 'delete_selected' in actions:
|