Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def change_keywords(request):
username = request.session.get('user', '')
keywords = Webcase_keywords.objects.all()
if request.method == "POST":
id = request.POST.get("id", )
library = request.POST.get("editlibrary", )
keyword = request.POST.get("editkeyword", )
parames = request.POST.get("editparames", )
comment = request.POST.get("editcomment", )
Webcase_keywords.objects.filter(keyword_id=id).update(library=library,keyword=keyword,parameter=parames,comment=comment)
return render(request, "keywordslibrary.html", {"user": username, "keywords": keywords})
def add_keywords(request):
username = request.session.get('user', '')
keywords = Webcase_keywords.objects.all()
if request.method == "POST":
library = request.POST.get("library", )
keyword = request.POST.get("keyword", )
parames = request.POST.get("parames", )
comment = request.POST.get("comment", )
Webcase_keywords.objects.get_or_create(library=library, keyword=keyword,parameter=parames,comment=comment)
return render(request,"keywordslibrary.html",{"user": username, "keywords": keywords})
def del_keywords(request):
username = request.session.get('user', '')
keywords = Webcase_keywords.objects.all()
if request.method == "POST":
try:
id= request.POST.get("id")
print(id)
Webcase_keywords.objects.filter(keyword_id=id).delete()
except Exception as e:
print("error")
return render(request, "keywordslibrary.html", {"user": username, "keywords": keywords})
#修改关键字参数