def processing(self, user, profile, msg): # Умови при яких зміни не відбудуться: if profile and profile.is_recognized == True: msg.title = user.username msg.type = msgType.NoChange msg.message = "Акаунт раніше вже був підтверджений!" else: # Робимо зміни: if not profile: profile = UserProfile(user=user) profile.is_recognized = True profile.save() user.userprofile = profile msg.title = user.username msg.type = msgType.Change msg.message = "Акаунт підтверджено!" e_msg_body = "Ваш акаунт на сайті підтверджено!" self.send_e_mail(user, e_msg_body) return user, msg
def processing(self, user, profile, msg): # Умови при яких зміни не відбудуться: if profile and profile.is_recognized == False: msg.title = user.username msg.type = msgType.NoChange msg.message = "Акаунт раніше вже був відхилений!" else: # Робимо зміни: if not profile: profile = UserProfile(user=user) profile.is_recognized = False profile.save() user.userprofile = profile user.is_active = False user.save() msg.title = user.username msg.type = msgType.Change msg.message = "Акаунт відхилено і деактивовано!" e_msg_body = "Ваш акаунт на сайті відхилено і деактивовано." self.send_e_mail(user, e_msg_body) return user, msg