From b3114a1f3ddfcc19db29432d1d19bf02a79d0095 Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 27 Dec 2019 16:03:45 +0800 Subject: [PATCH] =?UTF-8?q?[Bugfix]=20=E4=BF=AE=E5=A4=8Dvault=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E9=80=89=E6=8B=A9id=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/backends/base.py | 7 +++-- .../templates/assets/_asset_update_modal.html | 4 --- apps/templates/_import_modal.html | 28 ------------------- apps/templates/_update_modal.html | 28 ------------------- 4 files changed, 4 insertions(+), 63 deletions(-) delete mode 100644 apps/assets/templates/assets/_asset_update_modal.html delete mode 100644 apps/templates/_import_modal.html delete mode 100644 apps/templates/_update_modal.html diff --git a/apps/assets/backends/base.py b/apps/assets/backends/base.py index d46c67f70..9c9f7ca1e 100644 --- a/apps/assets/backends/base.py +++ b/apps/assets/backends/base.py @@ -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: diff --git a/apps/assets/templates/assets/_asset_update_modal.html b/apps/assets/templates/assets/_asset_update_modal.html deleted file mode 100644 index 68b2ff8db..000000000 --- a/apps/assets/templates/assets/_asset_update_modal.html +++ /dev/null @@ -1,4 +0,0 @@ -{% extends '_update_modal.html' %} -{% load i18n %} - -{% block modal_title%}{% trans "Update assets" %}{% endblock %} diff --git a/apps/templates/_import_modal.html b/apps/templates/_import_modal.html deleted file mode 100644 index 9211bdcb9..000000000 --- a/apps/templates/_import_modal.html +++ /dev/null @@ -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 %} -
- {% csrf_token %} -
- - {% trans 'Download the import template' %} -
- -
- - -
-
- -
-

-

-

-

-
-{% endblock %} diff --git a/apps/templates/_update_modal.html b/apps/templates/_update_modal.html deleted file mode 100644 index db2b14110..000000000 --- a/apps/templates/_update_modal.html +++ /dev/null @@ -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 %} -
- {% csrf_token %} -
- - {% trans 'Download the update template' %} -
- -
- - -
-
- -
-

-

-

-

-
-{% endblock %}