Merge pull request #3571 from jumpserver/bugfix

[Bugfix] 修复vault导出选择id的bug
pull/3575/head
BaiJiangJie 5 years ago committed by GitHub
commit a2350e7f1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,7 +43,7 @@ class AssetUserQuerySet(list):
else:
in_kwargs[k] = v
for k in in_kwargs:
kwargs.pop(k)
kwargs.pop(k, None)
if len(in_kwargs) == 0:
return self
@ -56,7 +56,7 @@ class AssetUserQuerySet(list):
v = [str(i) for i in v]
if isinstance(attr, uuid.UUID):
attr = str(attr)
if v in attr:
if attr in v:
matched = True
if matched:
queryset.append(i)
@ -68,11 +68,12 @@ class AssetUserQuerySet(list):
real = []
for k, v in kwargs.items():
wanted.append(v)
value = getattr(obj, k)
value = getattr(obj, k, None)
if isinstance(value, uuid.UUID):
value = str(value)
real.append(value)
return wanted == real
kwargs = {k: v for k, v in kwargs.items() if k.find('__in') == -1}
if len(kwargs) > 0:
queryset = AssetUserQuerySet([i for i in self if filter_it(i)])
else:

@ -1,4 +0,0 @@
{% extends '_update_modal.html' %}
{% load i18n %}
{% block modal_title%}{% trans "Update assets" %}{% endblock %}

@ -1,28 +0,0 @@
{% extends '_modal.html' %}
{% load i18n %}
{% block modal_id %}import_modal{% endblock %}
{% block modal_confirm_id %}btn_import_confirm{% endblock %}
{% block modal_body %}
<form method="post" id="fm_import">
{% csrf_token %}
<div class="form-group">
<label class="control-label">{% trans "Download the imported template or use the exported CSV file format" %}</label>
<a href="{% block import_modal_download_template_url %}{% endblock %}?format=csv&template=import&limit=1" style="display: block">{% trans 'Download the import template' %}</a>
</div>
<div class="form-group">
<label class="control-label" for="id_file">{% trans "Select the CSV file to import" %}</label>
<input id="id_file" type="file" name="file" />
</div>
</form>
<div>
<p class="text-success" id="success_created"></p>
<p id="success_created_detail"></p>
<p class="text-danger" id="created_failed"></p>
<p id="created_failed_detail"></p>
</div>
{% endblock %}

@ -1,28 +0,0 @@
{% extends '_modal.html' %}
{% load i18n %}
{% block modal_id %}update_modal{% endblock %}
{% block modal_confirm_id %}btn_update_confirm{% endblock %}
{% block modal_body %}
<form method="post" id="fm_import">
{% csrf_token %}
<div class="form-group">
<label class="control-label">{% trans "Download the update template or use the exported CSV file format" %}</label>
<a id="download_update_template" style="display: block">{% trans 'Download the update template' %}</a>
</div>
<div class="form-group">
<label class="control-label" for="update_file">{% trans "Select the CSV file to import" %}</label>
<input id="update_file" type="file" name="file" />
</div>
</form>
<div>
<p class="text-warning" id="success_updated"></p>
<p id="success_updated_detail"></p>
<p class="text-danger" id="updated_failed"></p>
<p id="updated_failed_detail"></p>
</div>
{% endblock %}
Loading…
Cancel
Save