This commit is contained in:
Ross
2021-12-12 11:24:18 +00:00
parent c79067b4d6
commit 319d835815
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -97,7 +97,7 @@
console.log(data); console.log(data);
if (data.status == "success") { if (data.status == "success") {
toastr.info('Added'); toastr.info('Added/Updated');
location.reload(); location.reload();
} }
// show some message according to the response. // show some message according to the response.
+5 -1
View File
@@ -963,7 +963,6 @@ def manage_cid_users(request):
selected_cids = json.loads(request.POST.get("selected_cids")) selected_cids = json.loads(request.POST.get("selected_cids"))
new_cid = max(CidUser.objects.all().order_by("-cid")[0].cid + 1, 50000)
number_to_create = int(request.POST.get("number_to_create")) number_to_create = int(request.POST.get("number_to_create"))
@@ -1022,6 +1021,11 @@ def manage_cid_users(request):
c.save() c.save()
return JsonResponse({"status": "success"}) return JsonResponse({"status": "success"})
try:
new_cid = CidUser.objects.all().order_by("-cid")[0].cid + 1
except IndexError:
new_cid = 10000
for n in range(number_to_create): for n in range(number_to_create):
passcode = "".join(random.choices(string.ascii_uppercase, k=4)) passcode = "".join(random.choices(string.ascii_uppercase, k=4))
c = CidUser(cid=new_cid, passcode=passcode) c = CidUser(cid=new_cid, passcode=passcode)