def createConfig(name,value): if getConfig(name) is None: c = Config() c.name = name c.value = value c.active = True c.save()
def config_edit(request, config_id): config = Config.get_by_id(int(config_id)) if config is None: raise Http404 if request.method == 'POST': form = ConfigForm(request.POST, instance=config) if form.is_valid(): logging.info('edit config before - id: %s key: %s data: %s' % (config.key().id() , config.key(), config)) form.save(commit=False) logging.info('edit config after - id: %s key: %s data: %s' % (config.key().id() , config.key(), config)) config.save() return redirect('/utils/config/') else: form = ConfigForm(instance=config) return render_to_response('utils/config_edit.html', RequestContext(request, { 'form': form }) )
def config_show(request,config_id): config = Config.get_by_id(int(config_id)) if config is None: raise Http404 return render_to_response('utils/config_show.html', RequestContext(request, { 'config': config }))
URLOrFile = Union[str, File] releases_data: Response = requests.get( url= "https://api.github.com/repos/Victorsitou/Discord-Webhook-Sender/releases") version = "v2.0" current_version: str = releases_data.json()[0]["tag_name"] ctypes.windll.kernel32.SetConsoleTitleW( f"Discord Webhook Sender v{version} | Made by github.com/Victorsitou") init(autoreset=True) with open("config.json") as f: data = Config(**json.load(f)) print(data) wb: SyncWebhook = SyncWebhook.from_url(url=data.webhook) fore: AnsiFore = convert_color(data.console_color) print(f"""{fore} ██╗ ██╗███████╗██████╗ ██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ ███████╗███████╗███╗ ██╗██████╗ ███████╗██████╗ ██║ ██║██╔════╝██╔══██╗██║ ██║██╔═══██╗██╔═══██╗██║ ██╔╝ ██╔════╝██╔════╝████╗ ██║██╔══██╗██╔════╝██╔══██╗ ██║ █╗ ██║█████╗ ██████╔╝███████║██║ ██║██║ ██║█████╔╝ ███████╗█████╗ ██╔██╗ ██║██║ ██║█████╗ ██████╔╝ ██║███╗██║██╔══╝ ██╔══██╗██╔══██║██║ ██║██║ ██║██╔═██╗ ╚════██║██╔══╝ ██║╚██╗██║██║ ██║██╔══╝ ██╔══██╗ ╚███╔███╔╝███████╗██████╔╝██║ ██║╚██████╔╝╚██████╔╝██║ ██╗ ███████║███████╗██║ ╚████║██████╔╝███████╗██║ ██║ ╚══╝╚══╝ ╚══════╝╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚═╝ ╚═══╝╚═════╝ ╚══════╝╚═╝ ╚═╝\n""" )