mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Clean up form display
This commit is contained in:
@ -1097,6 +1097,7 @@ class ConsolePortForm(CustomFieldModelForm):
|
|||||||
widgets = {
|
widgets = {
|
||||||
'device': forms.HiddenInput(),
|
'device': forms.HiddenInput(),
|
||||||
'type': StaticSelect(),
|
'type': StaticSelect(),
|
||||||
|
'speed': StaticSelect(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1114,6 +1115,7 @@ class ConsoleServerPortForm(CustomFieldModelForm):
|
|||||||
widgets = {
|
widgets = {
|
||||||
'device': forms.HiddenInput(),
|
'device': forms.HiddenInput(),
|
||||||
'type': StaticSelect(),
|
'type': StaticSelect(),
|
||||||
|
'speed': StaticSelect(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1234,6 +1236,17 @@ class InterfaceForm(InterfaceCommonForm, CustomFieldModelForm):
|
|||||||
'mgmt_only', 'mark_connected', 'description', 'mode', 'rf_role', 'rf_channel', 'rf_channel_frequency',
|
'mgmt_only', 'mark_connected', 'description', 'mode', 'rf_role', 'rf_channel', 'rf_channel_frequency',
|
||||||
'rf_channel_width', 'tx_power', 'wireless_lans', 'untagged_vlan', 'tagged_vlans', 'tags',
|
'rf_channel_width', 'tx_power', 'wireless_lans', 'untagged_vlan', 'tagged_vlans', 'tags',
|
||||||
]
|
]
|
||||||
|
# fieldsets = (
|
||||||
|
# ('Interface', ('device', 'name', 'type', 'label', 'description', 'tags')),
|
||||||
|
# ('Addressing', ('mac_address', 'wwn')),
|
||||||
|
# ('Operation', ('mtu', 'tx_power', 'enabled', 'mgmt_only', 'mark_connected')),
|
||||||
|
# ('Related Interfaces', ('parent', 'bridge', 'lag')),
|
||||||
|
# ('802.1Q Switching', ('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans')),
|
||||||
|
# ('Wireless', (
|
||||||
|
# 'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'wireless_lan_group',
|
||||||
|
# 'wireless_lans',
|
||||||
|
# )),
|
||||||
|
# )
|
||||||
widgets = {
|
widgets = {
|
||||||
'device': forms.HiddenInput(),
|
'device': forms.HiddenInput(),
|
||||||
'type': StaticSelect(),
|
'type': StaticSelect(),
|
||||||
|
@ -707,8 +707,8 @@ class ComponentCreateView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View
|
|||||||
|
|
||||||
return render(request, self.template_name, {
|
return render(request, self.template_name, {
|
||||||
'obj_type': self.queryset.model._meta.verbose_name,
|
'obj_type': self.queryset.model._meta.verbose_name,
|
||||||
'form': form,
|
'replication_form': form,
|
||||||
'model_form': model_form,
|
'form': model_form,
|
||||||
'return_url': self.get_return_url(request),
|
'return_url': self.get_return_url(request),
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -725,8 +725,8 @@ class ComponentCreateView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View
|
|||||||
|
|
||||||
return render(request, self.template_name, {
|
return render(request, self.template_name, {
|
||||||
'obj_type': self.queryset.model._meta.verbose_name,
|
'obj_type': self.queryset.model._meta.verbose_name,
|
||||||
'form': form,
|
'replication_form': form,
|
||||||
'model_form': model_form,
|
'form': model_form,
|
||||||
'return_url': self.get_return_url(request),
|
'return_url': self.get_return_url(request),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
{% load form_helpers %}
|
{% load form_helpers %}
|
||||||
|
|
||||||
{% block form %}
|
{% block form %}
|
||||||
{% render_form form %}
|
{% render_form replication_form %}
|
||||||
{% render_form model_form %}
|
{{ block.super }}
|
||||||
{% endblock form %}
|
{% endblock form %}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
{% extends 'generic/object_edit.html' %}
|
|
||||||
|
|
||||||
{% block buttons %}
|
|
||||||
<a class="btn btn-outline-danger" href="{{ return_url }}">Cancel</a>
|
|
||||||
{% if component_type == 'interface' and perms.ipam.add_ipaddress %}
|
|
||||||
<button type="submit" name="_assignip" class="btn btn-outline-success">
|
|
||||||
Create & Assign IP Address
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
|
||||||
<button type="submit" name="_addanother" class="btn btn-outline-primary">
|
|
||||||
Create & Add Another
|
|
||||||
</button>
|
|
||||||
<button type="submit" name="_create" class="btn btn-primary">
|
|
||||||
Create
|
|
||||||
</button>
|
|
||||||
{% endblock %}
|
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
{# Render grouped fields according to Form #}
|
{# Render grouped fields according to Form #}
|
||||||
{% for group, fields in form.Meta.fieldsets %}
|
{% for group, fields in form.Meta.fieldsets %}
|
||||||
<div class="field-group my-5">
|
<div class="field-group mb-5">
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<h5 class="offset-sm-3">{{ group }}</h5>
|
<h5 class="offset-sm-3">{{ group }}</h5>
|
||||||
</div>
|
</div>
|
||||||
@ -51,7 +51,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if form.custom_fields %}
|
{% if form.custom_fields %}
|
||||||
<div class="field-group my-5">
|
<div class="field-group mb-5">
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<h5 class="offset-sm-3">Custom Fields</h5>
|
<h5 class="offset-sm-3">Custom Fields</h5>
|
||||||
</div>
|
</div>
|
||||||
@ -60,7 +60,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if form.comments %}
|
{% if form.comments %}
|
||||||
<div class="field-group my-5">
|
<div class="field-group mb-5">
|
||||||
<h5 class="text-center">Comments</h5>
|
<h5 class="text-center">Comments</h5>
|
||||||
{% render_field form.comments %}
|
{% render_field form.comments %}
|
||||||
</div>
|
</div>
|
||||||
@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
{# Render all fields in a single group #}
|
{# Render all fields in a single group #}
|
||||||
<div class="field-group my-5">
|
<div class="field-group mb-5">
|
||||||
{% block form_fields %}{% render_form form %}{% endblock %}
|
{% block form_fields %}{% render_form form %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -346,11 +346,7 @@ class ExpandableNameField(forms.CharField):
|
|||||||
if not self.help_text:
|
if not self.help_text:
|
||||||
self.help_text = """
|
self.help_text = """
|
||||||
Alphanumeric ranges are supported for bulk creation. Mixed cases and types within a single range
|
Alphanumeric ranges are supported for bulk creation. Mixed cases and types within a single range
|
||||||
are not supported. Examples:
|
are not supported. Example: <code>[ge,xe]-0/0/[0-9]</code>
|
||||||
<ul>
|
|
||||||
<li><code>[ge,xe]-0/0/[0-9]</code></li>
|
|
||||||
<li><code>e[0-3][a-d,f]</code></li>
|
|
||||||
</ul>
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def to_python(self, value):
|
def to_python(self, value):
|
||||||
|
Reference in New Issue
Block a user