def delete_friends(request):
current_username = request.POST.get('username')
current_friendName = request.POST.get('friendUsername')
ol=[]
try:
existingUser = FriendList.objects.get(user__username = current_username)
user_friends = existingUser.getfoo()
for c in user_friends:
c = unicodedata.normalize('NFKD', c).encode('ascii','ignore')
if(c == current_friendName):
continue
ol.append(c)
existingUser.friendList = json.dumps(ol)
existingUser.save()
except:
ol=[]
return HttpResponse(json.dumps(ol))
评论列表
文章目录