Commit 33c29956 authored by ibuler's avatar ibuler

[Update] 修复bug

parent 84634eb8
......@@ -358,11 +358,17 @@ def get_short_uuid_str():
return str(uuid.uuid4()).split('-')[-1]
def is_uuid(s):
if UUID_PATTERN.match(s):
return True
def is_uuid(seq):
if isinstance(seq, str):
if UUID_PATTERN.match(seq):
return True
else:
return False
else:
return False
for s in seq:
if not is_uuid(s):
return False
return True
def get_signer():
......@@ -386,3 +392,4 @@ class TeeObj:
def close(self):
self.file_obj.close()
......@@ -8,7 +8,7 @@ from django.views.generic.edit import DeleteView
from django.urls import reverse_lazy
from django.conf import settings
from common.utils import get_object_or_none
from common.utils import is_uuid
from .hands import AdminUserRequiredMixin, Node, Asset
from .models import AssetPermission
from .forms import AssetPermissionForm
......@@ -37,13 +37,15 @@ class AssetPermissionCreateView(AdminUserRequiredMixin, CreateView):
def get_form(self, form_class=None):
form = super().get_form(form_class=form_class)
nodes_id = self.request.GET.get("nodes").split(",")
assets_id = self.request.GET.get("assets").split(",")
nodes_id = self.request.GET.get("nodes")
assets_id = self.request.GET.get("assets")
if nodes_id:
nodes_id = nodes_id.split(",")
nodes = Node.objects.filter(id__in=nodes_id)
form['nodes'].initial = nodes
if assets_id:
assets_id = assets_id.split(",")
assets = Asset.objects.filter(id__in=assets_id)
form['assets'].initial = assets
return form
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment