(user)
return role_check
Shortcut to identify moderators from users.
Shortcut to identify moderators from users.
Shortcut to identify moderators from users .
def is_moderator(user):
    """
    Shortcut to identify moderators from users.
    """

    # Anonymous users have no moderation rights.
    if user.is_anonymous:
        return False

    # User has been inactivated.
    if not user.is_active:
        return False

    # Staff or superusers have moderation rights.
    if user.is_staff or user.is_superuser:
        return True

    # Local roles that permit moderation.
    role_check = user.profile.role in (Profile.MODERATOR, Profile.MANAGER)

    return role_check
def is_moderator ( user ) : # Anonymous users have no moderation rights. if user . is_anonymous : return False # User has been inactivated. if not user . is_active : return False # Staff or superusers have moderation rights. if user . is_staff or user . is_superuser : return True # Local roles that permit moderation. role_check = user . profile . role in ( Profile . MODERATOR , Profile . MANAGER ) return role_check