Преглед на файлове

Handle null table in TableConfigForm

Brian Tiemann преди 1 година
родител
ревизия
3b894f9ccb
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3 2
      netbox/utilities/forms/forms.py

+ 3 - 2
netbox/utilities/forms/forms.py

@@ -132,8 +132,9 @@ class TableConfigForm(forms.Form):
         super().__init__(*args, **kwargs)
 
         # Initialize columns field based on table attributes
-        self.fields['available_columns'].choices = table.available_columns
-        self.fields['columns'].choices = table.selected_columns
+        if table:
+            self.fields['available_columns'].choices = table.available_columns
+            self.fields['columns'].choices = table.selected_columns
 
     @property
     def table_name(self):