Browse Source

Provide an inline form for IP allocation to every configuration types

Baptiste Jonglez 10 years ago
parent
commit
cd03536563
2 changed files with 4 additions and 3 deletions
  1. 3 0
      coin/configuration/admin.py
  2. 1 3
      coin/vpn/admin.py

+ 3 - 0
coin/configuration/admin.py

@@ -55,5 +55,8 @@ class ParentConfigurationAdmin(PolymorphicParentModelAdmin):
 
 class ConfigurationAdminFormMixin(object):
     base_form = ConfigurationForm
+    # For each child (admin object for configurations), this will display
+    # an inline form to assign IP addresses.
+    inlines = (IPSubnetInline, )
 
 admin.site.register(Configuration, ParentConfigurationAdmin)

+ 1 - 3
coin/vpn/admin.py

@@ -5,7 +5,7 @@ from django.contrib import admin
 from polymorphic.admin import PolymorphicChildModelAdmin
 
 from coin.vpn.models import VPNConfiguration
-from coin.configuration.admin import ConfigurationAdminFormMixin, IPSubnetInline
+from coin.configuration.admin import ConfigurationAdminFormMixin
 from coin.utils import delete_selected
 
 
@@ -30,8 +30,6 @@ class VPNConfigurationAdmin(ConfigurationAdminFormMixin, PolymorphicChildModelAd
                "generate_endpoints_v6", "activate", "deactivate")
     exclude = ("password",)
     inline = VPNConfigurationInline
-    # TODO: this should be done in the generic configuration admin.
-    inlines = (IPSubnetInline, )
 
     def get_readonly_fields(self, request, obj=None):
         if obj: