Skip to content

Commit f3bfe29

Browse files
committed
Rename choices to extra_choices (prep for #12194)
1 parent 70e1e11 commit f3bfe29

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

netbox/extras/api/serializers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class CustomFieldChoiceSetSerializer(ValidatedModelSerializer):
135135
class Meta:
136136
model = CustomFieldChoiceSet
137137
fields = [
138-
'id', 'url', 'display', 'name', 'description', 'choices', 'created', 'last_updated',
138+
'id', 'url', 'display', 'name', 'description', 'extra_choices', 'created', 'last_updated',
139139
]
140140

141141

netbox/extras/forms/bulk_import.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Meta:
6767

6868

6969
class CustomFieldChoiceSetImportForm(CSVModelForm):
70-
choices = SimpleArrayField(
70+
extra_choices = SimpleArrayField(
7171
base_field=forms.CharField(),
7272
required=False,
7373
help_text=_('Comma-separated list of field choices')
@@ -76,7 +76,7 @@ class CustomFieldChoiceSetImportForm(CSVModelForm):
7676
class Meta:
7777
model = CustomFieldChoiceSet
7878
fields = (
79-
'name', 'description', 'choices',
79+
'name', 'description', 'extra_choices',
8080
)
8181

8282

netbox/extras/forms/model_forms.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class CustomFieldChoiceSetForm(BootstrapMixin, forms.ModelForm):
8686

8787
class Meta:
8888
model = CustomFieldChoiceSet
89-
fields = ('name', 'description', 'choices')
89+
fields = ('name', 'description', 'extra_choices')
9090

9191

9292
class CustomLinkForm(BootstrapMixin, forms.ModelForm):

netbox/extras/migrations/0096_customfieldchoiceset.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def create_choice_sets(apps, schema_editor):
1919
for cf in choice_fields:
2020
choiceset = CustomFieldChoiceSet.objects.create(
2121
name=f'{cf.name} Choices',
22-
choices=cf.choices
22+
extra_choices=cf.choices
2323
)
2424
cf.choice_set = choiceset
2525

@@ -42,7 +42,7 @@ class Migration(migrations.Migration):
4242
('last_updated', models.DateTimeField(auto_now=True, null=True)),
4343
('name', models.CharField(max_length=100, unique=True)),
4444
('description', models.CharField(blank=True, max_length=200)),
45-
('choices', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), size=None)),
45+
('extra_choices', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), size=None)),
4646
],
4747
options={
4848
'ordering': ('name',),

netbox/extras/models/customfields.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ class CustomFieldChoiceSet(ChangeLoggedModel):
653653
max_length=200,
654654
blank=True
655655
)
656-
choices = ArrayField(
656+
extra_choices = ArrayField(
657657
base_field=models.CharField(max_length=100),
658658
help_text=_('Comma-separated list of available choices (for selection fields)')
659659
)
@@ -666,3 +666,7 @@ def __str__(self):
666666

667667
def get_absolute_url(self):
668668
return reverse('extras:customfieldchoiceset', args=[self.pk])
669+
670+
@property
671+
def choices(self):
672+
return self.extra_choices

netbox/extras/tables/tables.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ class CustomFieldChoiceSetTable(NetBoxTable):
8585
class Meta(NetBoxTable.Meta):
8686
model = CustomFieldChoiceSet
8787
fields = (
88-
'pk', 'id', 'name', 'description', 'choices', 'created', 'last_updated',
88+
'pk', 'id', 'name', 'description', 'extra_choices', 'created', 'last_updated',
8989
)
90-
default_columns = ('pk', 'name', 'description', 'choices')
90+
default_columns = ('pk', 'name', 'description', 'extra_choices')
9191

9292

9393
class CustomLinkTable(NetBoxTable):

0 commit comments

Comments
 (0)