Advertisement
kellykamay

post save

Jan 15th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. print("instance.data['categories'] before loop",instance.data['categories'])
  2.     for cat in instance.data['categories']:
  3.         print("cat ", cat)
  4.         print("instance.story.categories Before if", instance.story.categories)
  5.         if cat not in instance.story.categories:
  6.             print("instance.story.categories After if", instance.story.categories)
  7.             instance.story.categories.append(cat)
  8.             print("instance.story.categories After append", instance.story.categories)
  9.             story_changed = True
  10.     if story_changed:
  11.         print("story changed ", instance.data['categories'])
  12.         instance.story.save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement