mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-13 08:44:51 -06:00
Fixes #19659: Populate initial device/VM selection for 'add a service' button
This commit is contained in:
parent
0e68901022
commit
7e6b1bbd79
@ -826,7 +826,7 @@ class ServiceForm(NetBoxModelForm):
|
||||
except ObjectDoesNotExist:
|
||||
pass
|
||||
|
||||
if self.instance and parent_object_type_id != self.instance.parent_object_type_id:
|
||||
if self.instance and self.instance.pk and parent_object_type_id != self.instance.parent_object_type_id:
|
||||
self.initial['parent'] = None
|
||||
|
||||
def clean(self):
|
||||
|
@ -308,7 +308,7 @@
|
||||
{% trans "Services" %}
|
||||
{% if perms.ipam.add_service %}
|
||||
<div class="card-actions">
|
||||
<a href="{% url 'ipam:service_add' %}?device={{ object.pk }}" class="btn btn-ghost-primary btn-sm">
|
||||
<a href="{% url 'ipam:service_add' %}?parent_object_type={{ object|content_type_id }}&parent={{ object.pk }}" class="btn btn-ghost-primary btn-sm">
|
||||
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> {% trans "Add a service" %}
|
||||
</a>
|
||||
</div>
|
||||
|
@ -154,7 +154,7 @@
|
||||
{% trans "Services" %}
|
||||
{% if perms.ipam.add_service %}
|
||||
<div class="card-actions">
|
||||
<a href="{% url 'ipam:service_add' %}?virtual_machine={{ object.pk }}" class="btn btn-ghost-primary btn-sm">
|
||||
<a href="{% url 'ipam:service_add' %}?parent_object_type={{ object|content_type_id }}&parent={{ object.pk }}" class="btn btn-ghost-primary btn-sm">
|
||||
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> {% trans "Add a service" %}
|
||||
</a>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user