From 2d236879eab473818bfbb4253e60109db1a61c5d Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Thu, 18 Jun 2020 16:31:56 +0200 Subject: [PATCH] fix lowercase: duplicate key value violates unique constraint "accounts_tags_slug_key" (#387) Co-authored-by: Ashwin Kumar --- accounts/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/accounts/views.py b/accounts/views.py index 6652fbb7..5e6516da 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -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."}) +