mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #7358: Add missing choices column to custom field CSV import form
This commit is contained in:
@ -17,6 +17,7 @@
|
|||||||
* [#7341](https://github.com/netbox-community/netbox/issues/7341) - Fix incorrect URL in circuit breadcrumbs
|
* [#7341](https://github.com/netbox-community/netbox/issues/7341) - Fix incorrect URL in circuit breadcrumbs
|
||||||
* [#7353](https://github.com/netbox-community/netbox/issues/7353) - Fix bulk creation of device/VM components via list view
|
* [#7353](https://github.com/netbox-community/netbox/issues/7353) - Fix bulk creation of device/VM components via list view
|
||||||
* [#7356](https://github.com/netbox-community/netbox/issues/7356) - Fix display of model documentation when adding device components
|
* [#7356](https://github.com/netbox-community/netbox/issues/7356) - Fix display of model documentation when adding device components
|
||||||
|
* [#7358](https://github.com/netbox-community/netbox/issues/7358) - Add missing `choices` column to custom field CSV import form
|
||||||
* [#7360](https://github.com/netbox-community/netbox/issues/7360) - Correct redirection URL after removing child device from device bay
|
* [#7360](https://github.com/netbox-community/netbox/issues/7360) - Correct redirection URL after removing child device from device bay
|
||||||
|
|
||||||
## v3.0.3 (2021-09-20)
|
## v3.0.3 (2021-09-20)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
from django.contrib.postgres.forms import SimpleArrayField
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
@ -46,12 +47,17 @@ class CustomFieldCSVForm(CSVModelForm):
|
|||||||
limit_choices_to=FeatureQuery('custom_fields'),
|
limit_choices_to=FeatureQuery('custom_fields'),
|
||||||
help_text="One or more assigned object types"
|
help_text="One or more assigned object types"
|
||||||
)
|
)
|
||||||
|
choices = SimpleArrayField(
|
||||||
|
base_field=forms.CharField(),
|
||||||
|
required=False,
|
||||||
|
help_text='Comma-separated list of field choices'
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CustomField
|
model = CustomField
|
||||||
fields = (
|
fields = (
|
||||||
'name', 'label', 'type', 'content_types', 'required', 'description', 'weight', 'filter_logic', 'default',
|
'name', 'label', 'type', 'content_types', 'required', 'description', 'weight', 'filter_logic', 'default',
|
||||||
'weight',
|
'choices', 'weight',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,10 +39,10 @@ class CustomFieldTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
}
|
}
|
||||||
|
|
||||||
cls.csv_data = (
|
cls.csv_data = (
|
||||||
"name,label,type,content_types,weight,filter_logic",
|
'name,label,type,content_types,weight,filter_logic,choices',
|
||||||
"field4,Field 4,text,dcim.site,100,exact",
|
'field4,Field 4,text,dcim.site,100,exact,',
|
||||||
"field5,Field 5,text,dcim.site,100,exact",
|
'field5,Field 5,integer,dcim.site,100,exact,',
|
||||||
"field6,Field 6,text,dcim.site,100,exact",
|
'field6,Field 6,select,dcim.site,100,exact,"A,B,C"',
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
|
@ -56,7 +56,13 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Choices</th>
|
<th scope="row">Choices</th>
|
||||||
<td>{{ object.choices|placeholder }}</td>
|
<td>
|
||||||
|
{% if object.choices %}
|
||||||
|
{{ object.choices|join:", " }}
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">—</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Filter Logic</th>
|
<th scope="row">Filter Logic</th>
|
||||||
|
Reference in New Issue
Block a user