From 82faaed15dc67a15f079460f4c661bce4302a3c9 Mon Sep 17 00:00:00 2001 From: Anand Chitipothu Date: Tue, 4 May 2021 23:17:41 +0530 Subject: [PATCH] feat: set app name and logo on install and disable signup - set app_name and app_logo_url on install - disabled signup --- community/hooks.py | 6 +++++- community/install.py | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 community/install.py diff --git a/community/hooks.py b/community/hooks.py index 1332aebd..ea17ba2f 100644 --- a/community/hooks.py +++ b/community/hooks.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals from . import __version__ as app_version +import os app_name = "community" app_title = "Community" @@ -10,6 +11,9 @@ app_icon = "octicon octicon-file-directory" app_color = "grey" app_email = "jannat@erpnext.com" app_license = "AGPL" + +app_logo_url = os.getenv("APP_LOGO_URL") or "/files/logo.png" + # Includes in # ------------------ @@ -59,7 +63,7 @@ web_include_css = "/assets/css/community.css" # ------------ # before_install = "community.install.before_install" -# after_install = "community.install.after_install" +after_install = "community.install.after_install" # Desk Notifications # ------------------ diff --git a/community/install.py b/community/install.py new file mode 100644 index 00000000..ad627c67 --- /dev/null +++ b/community/install.py @@ -0,0 +1,16 @@ +"""Hooks that are executed during and after install. +""" +import os +import frappe + +def after_install(): + set_app_name() + disable_signup() + +def set_app_name(): + app_name = os.getenv("FRAPPE_APP_NAME") + if app_name: + frappe.db.set_value('System Settings', None, 'app_name', app_name) + +def disable_signup(): + frappe.db.set_value("Website Settings", None, "disable_signup", 1)