def create_status_feed(us, parents=None): for i in range(0, 10): if parents is not None: user = parents[random.choice(range(0, len(parents)))] else: user = us ac_list = user.get_profile().manage_playlist_children children = [] for ac in ac_list: children.append(ac.child) ac_child = children[random.choice(range(0, len(children)))] ctx = { 'actor': user.get_profile(), 'actor_children': ac_child.first_name, 'status': status_updates[random.choice(range(0, len(status_updates)))], 'when': times[random.choice(range(0, len(times)))], } up = create_status_update(us, 'status_update', ctx) create_user_update(us, up) exclude_users = [] exclude_users = exclude_users + create_user_update_for_child_playlist_adults( ac_child, up, exclude=exclude_users)
def save(self, *args, **kwargs): new = False if not self.id: album = Album(title="Profile Photos", created_by=self.user) album.save() self.album = album new = True # create first update up = create_update(self.user, "user_joined") create_user_update(self.user, up) super(Profile, self).save(*args, **kwargs) if new: self.album.owner = self self.album.save()
def save(self, *args, **kwargs): new = False if not self.id: album = Album(title="Profile Photos", created_by=self.user) album.save() self.album=album; new=True # create first update up = create_update(self.user, "user_joined") create_user_update(self.user, up) super(Profile, self).save(*args, **kwargs) if new: self.album.owner = self self.album.save()
def create_status_feed(us, parents = None): for i in range(0,10): if parents is not None: user = parents[random.choice(range(0, len(parents)))] else: user = us ac_list = user.get_profile().manage_playlist_children children = [] for ac in ac_list: children.append(ac.child) ac_child = children[random.choice(range(0, len(children) ) ) ] ctx = { 'actor':user.get_profile(), 'actor_children':ac_child.first_name, 'status':status_updates[random.choice(range(0, len(status_updates) ) ) ], 'when':times[random.choice(range(0, len(times)))], } up = create_status_update(us, 'status_update', ctx) create_user_update(us, up) exclude_users = [] exclude_users = exclude_users + create_user_update_for_child_playlist_adults(ac_child, up, exclude = exclude_users)