Skip to content

Commit 8e8132d

Browse files
TypeError: JSON object must not be list resolved
1 parent 829929d commit 8e8132d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

leads/views.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ def get_context_data(self, **kwargs):
8080
queryset = queryset.filter(source=params.get("source"))
8181
if params.getlist("assigned_to"):
8282
queryset = queryset.filter(
83-
assigned_to__id__in=json.loads(params.get("assigned_to"))
83+
assigned_to__id__in=params.get("assigned_to")
8484
)
8585
if params.get("status"):
8686
queryset = queryset.filter(status=params.get("status"))
8787
if params.get("tags"):
88-
queryset = queryset.filter(tags__in=json.loads(params.get("tags")))
88+
queryset = queryset.filter(tags__in=params.get("tags"))
8989
if params.get("city"):
9090
queryset = queryset.filter(city__icontains=params.get("city"))
9191
if params.get("email"):
@@ -165,7 +165,7 @@ def post(self, request, *args, **kwargs):
165165
lead_obj = serializer.save(created_by=request.profile.user
166166
, org=request.profile.org)
167167
if data.get("tags",None):
168-
tags = json.loads(data.get("tags"))
168+
tags = data.get("tags")
169169
for t in tags:
170170
tag = Tags.objects.filter(slug=t.lower())
171171
if tag.exists():
@@ -176,7 +176,7 @@ def post(self, request, *args, **kwargs):
176176

177177
if data.get("contacts",None):
178178
obj_contact = Contact.objects.filter(
179-
id__in=json.loads(data.get("contacts")), org=request.profile.org
179+
id__in=data.get("contacts"), org=request.profile.org
180180
)
181181
lead_obj.contacts.add(*obj_contact)
182182

@@ -195,12 +195,12 @@ def post(self, request, *args, **kwargs):
195195
attachment.save()
196196

197197
if data.get("teams",None):
198-
teams_list = json.loads(data.get("teams"))
198+
teams_list = data.get("teams")
199199
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
200200
lead_obj.teams.add(*teams)
201201

202202
if data.get("assigned_to",None):
203-
assinged_to_list = json.loads(data.get("assigned_to"))
203+
assinged_to_list = data.get("assigned_to")
204204
profiles = Profile.objects.filter(
205205
id__in=assinged_to_list, org=request.profile.org
206206
)
@@ -235,7 +235,7 @@ def post(self, request, *args, **kwargs):
235235
account_object.tags.add(tag)
236236

237237
if data.get("assigned_to",None):
238-
assigned_to_list = json.loads(data.getlist("assigned_to"))
238+
assigned_to_list = data.getlist("assigned_to")
239239
recipients = assigned_to_list
240240
send_email_to_assigned_user.delay(
241241
recipients,
@@ -438,7 +438,7 @@ def put(self, request, pk, **kwargs):
438438
)
439439
lead_obj.tags.clear()
440440
if params.get("tags"):
441-
tags = json.loads(params.get("tags"))
441+
tags = params.get("tags")
442442
# for t in tags:
443443
# tag,_ = Tags.objects.get_or_create(name=t)
444444
# lead_obj.tags.add(tag)
@@ -475,13 +475,13 @@ def put(self, request, pk, **kwargs):
475475

476476
lead_obj.teams.clear()
477477
if params.get("teams"):
478-
teams_list = json.loads(params.get("teams"))
478+
teams_list = params.get("teams")
479479
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
480480
lead_obj.teams.add(*teams)
481481

482482
lead_obj.assigned_to.clear()
483483
if params.get("assigned_to"):
484-
assinged_to_list = json.loads(params.get("assigned_to"))
484+
assinged_to_list = params.get("assigned_to")
485485
profiles = Profile.objects.filter(
486486
id__in=assinged_to_list, org=request.profile.org
487487
)
@@ -516,7 +516,7 @@ def put(self, request, pk, **kwargs):
516516
account_object.tags.add(tag)
517517
if params.get("assigned_to"):
518518
# account_object.assigned_to.add(*params.getlist('assigned_to'))
519-
assigned_to_list = json.loads(params.get("assigned_to"))
519+
assigned_to_list = params.get("assigned_to")
520520
recipients = assigned_to_list
521521
send_email_to_assigned_user.delay(
522522
recipients,

0 commit comments

Comments
 (0)