(mod, target, state)
Changes user state.
Changes user state.
Changes user state .
def change_user_state(mod, target, state):
    """
    Changes user state.
    """

    # Only moderators may change user states.
    if not mod.profile.is_moderator:
        logger.error(f"{mod} is not a moderator")
        return

    # Cannot moderate self.
    if mod == target:
        logger.error(f"{mod} cannot moderate themselves")
        return

    # The target may not be a moderator.
    if target.profile.is_moderator:
        logger.info(f"{mod} cannot alter state on a moderator {target}")
        return

    # Set the new state.
    target.profile.state = state
    target.profile.save()

    # Generate the logging message.
    msg = f"changed user state to {target.profile.get_state_display()}"
    auth.db_logger(user=mod, action=Log.MODERATE, target=target, text=msg, post=None)
def change_user_state ( mod , target , state ) : # Only moderators may change user states. if not mod . profile . is_moderator : logger . error ( f"{mod} is not a moderator" ) return # Cannot moderate self. if mod == target : logger . error ( f"{mod} cannot moderate themselves" ) return # The target may not be a moderator. if target . profile . is_moderator : logger . info ( f"{mod} cannot alter state on a moderator {target}" ) return # Set the new state. target . profile . state = state target . profile . save ( ) # Generate the logging message. msg = f"changed user state to {target.profile.get_state_display()}" auth . db_logger ( user = mod , action = Log . MODERATE , target = target , text = msg , post = None )