Commit 70b69d60 authored by Élie Bouttier's avatar Élie Bouttier

vérouillage suppression tunnel / route

parent fdeb4a72
......@@ -640,6 +640,10 @@ class RouteAdmin(admin.ModelAdmin):
return actions
def has_delete_permission(self, request, obj=None):
if obj:
if obj.allocations.exists():
return False
return True
return False
......@@ -649,6 +653,19 @@ class TunnelAdmin(admin.ModelAdmin):
ActiveTunnelFilter,
)
def get_actions(self, request):
actions = super().get_actions(request)
if 'delete_selected' in actions:
del actions['delete_selected']
return actions
def has_delete_permission(self, request, obj=None):
if obj:
if obj.allocations.exists():
return False
return True
return False
def active(self, obj):
return not obj.ended
active.short_description = 'Actif'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment