def setup_admin_user_publisher():
    """
    Setup Juice User and Publisher Admin
    :return:
    """

    # ==== Setup User Admin === #

    admin_email = conf.APPLICATION_ADMIN_EMAIL
    if not admin_email:
        print("ERROR: APPLICATION_ADMIN_EMAIL is empty")
        exit()

    password = utils.generate_random_string()
    if user.setup(model.User,
                  admin_email=admin_email,
                  password=password):

        if mail.validated:
            body = "Admin Password: %s" % password
            mail.send(to=admin_email, subject="Admin Password", body=body)

        print("---- Setup SUPER ADMIN User ----")
        print("- Admin Email: %s" % admin_email)
        print("- Admin Password: %s" % password)
        print("-" * 40)
        print("")

    # ==== Setup Publisher === #

    # admin user
    admin_user = model.User.User.get_by_email(admin_email)

    # Set default categories and post types
    post_categories = ["Uncategorized"]
    post_types = ["Page", "Blog", "Document", "Other"]

    if admin_user and admin_user.role.name.lower() == "superadmin":
        print("---- Setup PUBLISHER ----")
        if publisher.setup(model.Publisher,
                           admin_user_id=admin_user.id,
                           post_types=post_types,
                           post_categories=post_categories):
            print("Completed")
        print("-" * 40)
        print("")
def setup_admin_user_publisher ( ) : admin_email = conf . APPLICATION_ADMIN_EMAIL if not admin_email : print ( "ERROR: APPLICATION_ADMIN_EMAIL is empty" ) exit ( ) password = utils . generate_random_string ( ) if user . setup ( model . User , admin_email = admin_email , password = password ) : if mail . validated : body = "Admin Password: %s" % password mail . send ( to = admin_email , subject = "Admin Password" , body = body ) print ( "---- Setup SUPER ADMIN User ----" ) print ( "- Admin Email: %s" % admin_email ) print ( "- Admin Password: %s" % password ) print ( "-" * 40 ) print ( "" ) admin_user = model . User . User . get_by_email ( admin_email ) post_categories = [ "Uncategorized" ] post_types = [ "Page" , "Blog" , "Document" , "Other" ] if admin_user and admin_user . role . name . lower ( ) == "superadmin" : print ( "---- Setup PUBLISHER ----" ) if publisher . setup ( model . Publisher , admin_user_id = admin_user . id , post_types = post_types , post_categories = post_categories ) : print ( "Completed" ) print ( "-" * 40 ) print ( "" )
Setup Juice User and Publisher Admin
    :return: