fix lowercase: duplicate key value violates unique constraint "accounts_tags_slug_key" (#387)
Co-authored-by: Ashwin Kumar <ashwin@micropyramid.com>
This commit is contained in:
parent
4f0e1ae7e1
commit
2d236879ea
1 changed files with 3 additions and 2 deletions
|
|
@ -190,11 +190,11 @@ class CreateAccountView(SalesAccessRequiredMixin, LoginRequiredMixin, CreateView
|
|||
tags = self.request.POST.get("tags")
|
||||
splitted_tags = tags.split(",")
|
||||
for t in splitted_tags:
|
||||
tag = Tags.objects.filter(name=t.lower())
|
||||
tag = Tags.objects.filter(name=t)
|
||||
if tag:
|
||||
tag = tag[0]
|
||||
else:
|
||||
tag = Tags.objects.create(name=t.lower())
|
||||
tag = Tags.objects.create(name=t)
|
||||
account_object.tags.add(tag)
|
||||
if self.request.POST.getlist("contacts", []):
|
||||
account_object.contacts.add(*self.request.POST.getlist("contacts"))
|
||||
|
|
@ -768,3 +768,4 @@ def get_email_data_for_account(request):
|
|||
return JsonResponse(ctx)
|
||||
else:
|
||||
return JsonResponse({"error": True, "data": "No emails found."})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue