Guest User

Untitled

a guest
Apr 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. def find_similars(request):
  2. posts = Post.objects.get()
  3. for post1 in posts:
  4. words = post1.body.split(' ')
  5. for post2 in posts:
  6. for i in range(len(words)):
  7. if word[i] in post2.body:
  8. post2.similars = post1.id
  9. post1.save()
  10. return HttpResponseRedirect(reverse('post1', kwargs={'post': post}))
Add Comment
Please, Sign In to add comment