def createAskBasesForUsers(users, userWhoAsked, customQuestion): for user in users: askBase = AskBase(customQuestion=customQuestion, user=user) if userWhoAsked.pk == user.pk: askBase.isAccepted = True else: askBase.isAccepted = False #print "creating ask base for %s for question %s" % (user.username, customQuestion.question) askBase.save()
def save(self, commit=True): # generate AskBases for asked user and include self askedUsers = self.cleaned_data["users_to_ask"] print "the following users have been asked:" for askedUser in askedUsers: print "username: %s" % askedUser.username askBase = AskBase(customQuestion=self.customQuestion, user=askedUser) askBase.isAccepted = False askBase.save()
def save(self, commit=True): #generate AskBases for asked user and include self askedUsers = self.cleaned_data['users_to_ask'] print "the following users have been asked:" for askedUser in askedUsers: print "username: %s" % askedUser.username askBase = AskBase(customQuestion=self.customQuestion, user=askedUser) askBase.isAccepted = False askBase.save()
def registerNewUserToAllCandidateQuestions(user): for customQuestion in CustomQuestion.objects.all(): if customQuestion.creator.groups.filter(name='Candidate').exists(): askBase = AskBase(customQuestion=customQuestion, user=user) askBase.isAccepted = False askBase.save()