def save(self, commit=True): profile = super(ProfileUpdateForm, self).save(commit=False) profile.previous_account_status = self.initial_account_status if self.initial_account_status != profile.account_status: update_openldap_user(profile) if commit: profile.save() return profile
def activate_users(self, request, queryset): rows_updated = 0 for user in queryset: user.profile.account_status = Profile.APPROVED user.save() rows_updated += 1 update_openldap_user(user.profile) message = self._account_action_message(rows_updated) self.message_user( request, '{message} successfully submitted for activation.'.format( message=message))
def save(self, commit=True): profile = super(ProfileUpdateForm, self).save(commit=False) # Ensure any updates to the account status are propagated to LDAP. profile.previous_account_status = self.initial_account_status if self.initial_account_status != profile.account_status: update_openldap_user(profile) if commit: profile.save() return profile
def activate(self): self.status = self.APPROVED self.save() update_openldap_user(self)