Просмотр исходного кода

Closes #5024: List available options for choice fields within CSV import forms

Jeremy Stretch 5 лет назад
Родитель
Сommit
8f88d2afab
2 измененных файлов с 22 добавлено и 0 удалено
  1. 4 0
      docs/release-notes/version-2.9.md
  2. 18 0
      netbox/templates/utilities/obj_bulk_import.html

+ 4 - 0
docs/release-notes/version-2.9.md

@@ -2,6 +2,10 @@
 
 ## v2.9-beta3 (FUTURE)
 
+### Enhancements
+
+* [#5024](https://github.com/netbox-community/netbox/issues/5024) - List available options for choice fields within CSV import forms
+
 ### Bug Fixes
 
 * [#4990](https://github.com/netbox-community/netbox/issues/4990) - Restore change logging during custom script execution

+ 18 - 0
netbox/templates/utilities/obj_bulk_import.html

@@ -66,6 +66,24 @@
                                             {% endif %}
                                         </td>
                                         <td>
+                                            {% if field.choice_values %}
+                                                <button type="button" class="btn btn-primary btn-xs pull-right" data-toggle="modal" data-target="#{{ name }}_choices">
+                                                    <i class="fa fa-question"></i>
+                                                </button>
+                                                <div class="modal fade" id="{{ name }}_choices" tabindex="-1" role="dialog">
+                                                    <div class="modal-dialog" role="document">
+                                                        <div class="modal-content">
+                                                            <div class="modal-header">
+                                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+                                                                <h4 class="modal-title"><code>{{ name }}</code> Choices</h4>
+                                                            </div>
+                                                            <div class="modal-body">
+                                                                <ul>{% for value, label in field.choices %}{% if value %}<li>{{ value }}</li>{% endif %}{% endfor %}</ul>
+                                                            </div>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                            {% endif %}
                                             {% if field.help_text %}
                                                 {{ field.help_text }}<br />
                                             {% elif field.label %}