mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixed bug where placeholder prefixes were being included as 'None' in pk_all for bulk edit/delete
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
<form method="post" class="form form-horizontal">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="redirect_url" value="{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" />
|
||||
<input type="hidden" name="pk_all" value="{% for row in table.rows %}{{ row.record.pk }}{% if not forloop.last %},{% endif %}{% endfor %}" />
|
||||
<input type="hidden" name="pk_all" value="{% for row in table.rows %}{{ row.record.pk|default:'' }}{% if not forloop.last %},{% endif %}{% endfor %}" />
|
||||
{% render_table table table_template|default:'table.html' %}
|
||||
{% if perms.dcim.add_interface %}
|
||||
<button type="submit" name="_edit" formaction="{% url 'dcim:interface_bulk_add' %}" class="btn btn-primary btn-sm">
|
||||
|
@ -4,7 +4,7 @@
|
||||
<form method="post" class="form form-horizontal">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="redirect_url" value="{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" />
|
||||
<input type="hidden" name="pk_all" value="{% for row in table.rows %}{{ row.record.pk }}{% if not forloop.last %},{% endif %}{% endfor %}" />
|
||||
<input type="hidden" name="pk_all" value="{% for row in table.rows %}{{ row.record.pk|default:'' }}{% if not forloop.last %},{% endif %}{% endfor %}" />
|
||||
{% render_table table table_template|default:'table.html' %}
|
||||
{% if bulk_edit_url and table.model|user_can_change:request.user %}
|
||||
<button type="submit" name="_edit" formaction="{% url bulk_edit_url %}" class="btn btn-warning btn-sm">
|
||||
|
@ -261,7 +261,7 @@ class BulkEditView(View):
|
||||
redirect_url = reverse(self.default_redirect_url)
|
||||
|
||||
if request.POST.get('_all'):
|
||||
pk_list = request.POST.get('pk_all').split(',')
|
||||
pk_list = [x for x in request.POST.get('pk_all').split(',') if x]
|
||||
else:
|
||||
pk_list = request.POST.getlist('pk')
|
||||
|
||||
@ -318,7 +318,7 @@ class BulkDeleteView(View):
|
||||
redirect_url = reverse(self.default_redirect_url)
|
||||
|
||||
if request.POST.get('_all'):
|
||||
pk_list = request.POST.get('pk_all').split(',')
|
||||
pk_list = [x for x in request.POST.get('pk_all').split(',') if x]
|
||||
else:
|
||||
pk_list = request.POST.getlist('pk')
|
||||
|
||||
|
Reference in New Issue
Block a user