Fixes #1884: Provide additional context to identify devices when creating/editing avirtual chassis

This commit is contained in:
Jeremy Stretch
2018-02-14 11:14:04 -05:00
parent 28ea06a8bc
commit e653f35bf1
6 changed files with 34 additions and 5 deletions

View File

@@ -119,7 +119,7 @@ class ColorSelect(forms.Select):
"""
Extends the built-in Select widget to colorize each <option>.
"""
option_template_name = 'colorselect_option.html'
option_template_name = 'widgets/colorselect_option.html'
def __init__(self, *args, **kwargs):
kwargs['choices'] = COLOR_CHOICES
@@ -144,7 +144,14 @@ class SelectWithDisabled(forms.Select):
Modified the stock Select widget to accept choices using a dict() for a label. The dict for each option must include
'label' (string) and 'disabled' (boolean).
"""
option_template_name = 'selectwithdisabled_option.html'
option_template_name = 'widgets/selectwithdisabled_option.html'
class SelectWithPK(forms.Select):
"""
Include the primary key of each option in the option label (e.g. "Router7 (4721)").
"""
option_template_name = 'widgets/select_option_with_pk.html'
class ArrayFieldSelectMultiple(SelectWithDisabled, forms.SelectMultiple):

View File

@@ -0,0 +1 @@
<option value="{{ widget.value|stringformat:'s' }}"{% include "django/forms/widgets/attrs.html" %}>{{ widget.label }}{% if widget.value %} ({{ widget.value }}){% endif %}</option>