Commit 74595a22 authored by jocelyn's avatar jocelyn

[ehn] displays linked offers in ip pool list

parent 8840f25d
......@@ -4,10 +4,25 @@ from __future__ import unicode_literals
from django.contrib import admin
from coin.resources.models import IPPool, IPSubnet
from coin.offers.models import OfferIPPool
class OfferIPPoolAdmin(admin.TabularInline):
model = OfferIPPool
extra = 1
verbose_name_plural = "Offres utilisant ce pool d'IP"
verbose_name = "Offre utilisant ce pool d'IP"
class IPPoolAdmin(admin.ModelAdmin):
list_display = ('name', 'inet', 'default_subnetsize')
list_display = ('name', 'inet', 'default_subnetsize', 'linked_offers')
ordering = ('inet',)
inlines = [OfferIPPoolAdmin]
def linked_offers(self, obj):
offers = ( for i in obj.offers.all())
return '{}'.format(', '.join(offers) or 'aucune')
linked_offers.short_description = 'Offres liées'
# TODO: don't display "Delegate reverse DNS" checkbox and Nameservers when
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