Commit f91d9cea authored by alexAubin's avatar alexAubin

Fixes following rebase with now the new IPConfiguration class

parent 25223891
......@@ -72,6 +72,10 @@ class ConfigurationAdminFormMixin(object):
'provisioned',
'status']})]
if hasattr(obj, "ipv4_endpoint") and hasattr(obj, "ipv6_endpoint"):
fields.append(["Adresses IP (endpoints)",
{"fields": tuple(["ipv4_endpoint", "ipv6_endpoint"])}])
if hasattr(obj, "provisioning_infos") and obj.provisioning_infos:
fields.append(["Informations pour le provisionnement",
{"fields": tuple(obj.provisioning_infos)}])
......@@ -143,5 +147,4 @@ class ConfigurationAdminFormMixin(object):
return HttpResponseRedirect(reverse('admin:configuration_configuration_change',
args=(id,)))
admin.site.register(Configuration, ParentConfigurationAdmin)
......@@ -25,7 +25,7 @@ class ConfigurationForm(ModelForm):
super(ConfigurationForm, self).__init__(*args, **kwargs)
if self.instance:
queryset = OfferSubscription.objects.filter(
Q(offer__configuration_type=self.instance.model_name) & (
Q(offer__configuration_type=self.instance.configuration_type_name) & (
Q(configuration=None) | Q(configuration=self.instance.pk)))
if 'offersubscription' in self.fields:
self.fields['offersubscription'].queryset = queryset
......@@ -36,7 +36,7 @@ class ConfigurationForm(ModelForm):
offer which use the same configuration type than the edited configuration.
"""
offersubscription = self.cleaned_data['offersubscription']
if offersubscription.offer.configuration_type != self.instance.model_name():
if offersubscription.offer.configuration_type != self.instance.configuration_type_name():
raise ValidationError('Administrative subscription must refer an offer having a "{}" configuration type.'.format(self.instance.model_name()))
return offersubscription
......@@ -107,7 +107,6 @@ class Configuration(PolymorphicModel):
raise Exception("Le déprovisionnement a échoué : %s" % err)
self.provisioned = "no"
self.save()
>>>>>>> Foundation for provisioning mechanism through the admin
def update_state(self, provisioned=None, status=None, status_color=None, **kwargs):
if provisioned is not None:
......@@ -230,6 +229,14 @@ class IPConfiguration(Configuration):
help_text="Adresse IPv6 utilisée comme endpoint")
objects = NetManager()
def convert_to_dict_for_hook(self):
d = super(IPConfiguration, self).convert_to_dict_for_hook()
if self.ipv4_endpoint:
d["ipv4"] = str(self.ipv4_endpoint)
if self.ipv6_endpoint:
d["ipv6"] = str(self.ipv6_endpoint)
return d
# This method is part of the general configuration interface.
def subnet_event(self):
self.check_endpoints(delete=True)
......
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