Daniel Sheppard 4 лет назад
Родитель
Сommit
87e07e731d
1 измененных файлов с 1 добавлено и 16 удалено
  1. 1 16
      netbox/dcim/forms/models.py

+ 1 - 16
netbox/dcim/forms/models.py

@@ -162,7 +162,7 @@ class SiteForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
         }
         }
         help_texts = {
         help_texts = {
             'name': "Full name of the site",
             'name': "Full name of the site",
-            'asn': "BGP autonomous system number.  This field is depreciated in favour of the many-to-many field for ASNs",
+            'asn': "BGP autonomous system number.  This field is depreciated in favour of the ASN model",
             'facility': "Data center provider and facility (e.g. Equinix NY7)",
             'facility': "Data center provider and facility (e.g. Equinix NY7)",
             'time_zone': "Local time zone",
             'time_zone': "Local time zone",
             'description': "Short description (will appear in sites list)",
             'description': "Short description (will appear in sites list)",
@@ -178,21 +178,6 @@ class SiteForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
         if self.instance and self.instance.pk is not None:
         if self.instance and self.instance.pk is not None:
             self.fields['asns'].initial = self.instance.asns.all().values_list('id', flat=True)
             self.fields['asns'].initial = self.instance.asns.all().values_list('id', flat=True)
 
 
-        # Hide the ASN field if there is nothing there as this is deprecated
-        if instance is None or \
-                (instance and (instance.asn is None or instance.asn == '')) or \
-                (data and (data.get('asn') is None or instance.get('asn')) == ''):
-            if 'asn' in self.Meta.fieldsets[0][1]:
-                site_fieldset = list(self.Meta.fieldsets[0][1])
-                index = site_fieldset.index('asn')
-                site_fieldset.pop(index)
-                self.Meta.fieldsets = (
-                    ('Site', tuple(site_fieldset)),
-                    self.Meta.fieldsets[1],
-                    self.Meta.fieldsets[2],
-                )
-            del self.fields['asn']
-
     def save(self, *args, **kwargs):
     def save(self, *args, **kwargs):
         instance = super().save(*args, **kwargs)
         instance = super().save(*args, **kwargs)
         instance.asns.set(self.cleaned_data['asns'])
         instance.asns.set(self.cleaned_data['asns'])