mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 08:46:10 -06:00
Rename choices to extra_choices (prep for #12194)
This commit is contained in:
parent
70e1e1197e
commit
f3bfe29751
@ -135,7 +135,7 @@ class CustomFieldChoiceSetSerializer(ValidatedModelSerializer):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = CustomFieldChoiceSet
|
model = CustomFieldChoiceSet
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display', 'name', 'description', 'choices', 'created', 'last_updated',
|
'id', 'url', 'display', 'name', 'description', 'extra_choices', 'created', 'last_updated',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class CustomFieldImportForm(CSVModelForm):
|
|||||||
|
|
||||||
|
|
||||||
class CustomFieldChoiceSetImportForm(CSVModelForm):
|
class CustomFieldChoiceSetImportForm(CSVModelForm):
|
||||||
choices = SimpleArrayField(
|
extra_choices = SimpleArrayField(
|
||||||
base_field=forms.CharField(),
|
base_field=forms.CharField(),
|
||||||
required=False,
|
required=False,
|
||||||
help_text=_('Comma-separated list of field choices')
|
help_text=_('Comma-separated list of field choices')
|
||||||
@ -76,7 +76,7 @@ class CustomFieldChoiceSetImportForm(CSVModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = CustomFieldChoiceSet
|
model = CustomFieldChoiceSet
|
||||||
fields = (
|
fields = (
|
||||||
'name', 'description', 'choices',
|
'name', 'description', 'extra_choices',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class CustomFieldChoiceSetForm(BootstrapMixin, forms.ModelForm):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CustomFieldChoiceSet
|
model = CustomFieldChoiceSet
|
||||||
fields = ('name', 'description', 'choices')
|
fields = ('name', 'description', 'extra_choices')
|
||||||
|
|
||||||
|
|
||||||
class CustomLinkForm(BootstrapMixin, forms.ModelForm):
|
class CustomLinkForm(BootstrapMixin, forms.ModelForm):
|
||||||
|
@ -19,7 +19,7 @@ def create_choice_sets(apps, schema_editor):
|
|||||||
for cf in choice_fields:
|
for cf in choice_fields:
|
||||||
choiceset = CustomFieldChoiceSet.objects.create(
|
choiceset = CustomFieldChoiceSet.objects.create(
|
||||||
name=f'{cf.name} Choices',
|
name=f'{cf.name} Choices',
|
||||||
choices=cf.choices
|
extra_choices=cf.choices
|
||||||
)
|
)
|
||||||
cf.choice_set = choiceset
|
cf.choice_set = choiceset
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class Migration(migrations.Migration):
|
|||||||
('last_updated', models.DateTimeField(auto_now=True, null=True)),
|
('last_updated', models.DateTimeField(auto_now=True, null=True)),
|
||||||
('name', models.CharField(max_length=100, unique=True)),
|
('name', models.CharField(max_length=100, unique=True)),
|
||||||
('description', models.CharField(blank=True, max_length=200)),
|
('description', models.CharField(blank=True, max_length=200)),
|
||||||
('choices', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), size=None)),
|
('extra_choices', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), size=None)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ('name',),
|
'ordering': ('name',),
|
||||||
|
@ -653,7 +653,7 @@ class CustomFieldChoiceSet(ChangeLoggedModel):
|
|||||||
max_length=200,
|
max_length=200,
|
||||||
blank=True
|
blank=True
|
||||||
)
|
)
|
||||||
choices = ArrayField(
|
extra_choices = ArrayField(
|
||||||
base_field=models.CharField(max_length=100),
|
base_field=models.CharField(max_length=100),
|
||||||
help_text=_('Comma-separated list of available choices (for selection fields)')
|
help_text=_('Comma-separated list of available choices (for selection fields)')
|
||||||
)
|
)
|
||||||
@ -666,3 +666,7 @@ class CustomFieldChoiceSet(ChangeLoggedModel):
|
|||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse('extras:customfieldchoiceset', args=[self.pk])
|
return reverse('extras:customfieldchoiceset', args=[self.pk])
|
||||||
|
|
||||||
|
@property
|
||||||
|
def choices(self):
|
||||||
|
return self.extra_choices
|
||||||
|
@ -85,9 +85,9 @@ class CustomFieldChoiceSetTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = CustomFieldChoiceSet
|
model = CustomFieldChoiceSet
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'name', 'description', 'choices', 'created', 'last_updated',
|
'pk', 'id', 'name', 'description', 'extra_choices', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = ('pk', 'name', 'description', 'choices')
|
default_columns = ('pk', 'name', 'description', 'extra_choices')
|
||||||
|
|
||||||
|
|
||||||
class CustomLinkTable(NetBoxTable):
|
class CustomLinkTable(NetBoxTable):
|
||||||
|
Loading…
Reference in New Issue
Block a user