diff --git a/bots/admin.py b/bots/admin.py index 8c38f3f..2e02d03 100644 --- a/bots/admin.py +++ b/bots/admin.py @@ -1,3 +1,14 @@ from django.contrib import admin +from .models import TelegramBot +from .modules import EchoBotModuleConfig, ChannelHelperBotModuleConfig, OverlayBotModuleConfig, QueuedItem -# Register your models here. + +@admin.register(TelegramBot) +class TelegramBot(admin.ModelAdmin): + list_display = '__str__', 'active', + + +admin.site.register(EchoBotModuleConfig) +admin.site.register(ChannelHelperBotModuleConfig) +admin.site.register(OverlayBotModuleConfig) +admin.site.register(QueuedItem) diff --git a/bots/forms.py b/bots/forms.py index fae9a9f..f3c4101 100644 --- a/bots/forms.py +++ b/bots/forms.py @@ -1,3 +1,5 @@ +from crispy_forms.helper import FormHelper +from crispy_forms.layout import Layout, Fieldset from django import forms from django.forms import ModelForm from djconfig.forms import ConfigForm @@ -26,3 +28,12 @@ class BotsAppConfigForm(ConfigForm): title = 'Bots' tmp_uploads_chat_id = forms.CharField(required=True) + + helper = FormHelper() + helper.form_class = 'form-horizontal' + helper.label_class = 'col-sm-2' + helper.field_class = 'col-sm-10' + helper.form_tag = False + helper.layout = Layout( + Fieldset('Global', 'tmp_uploads_chat_id'), + ) diff --git a/bots/modules/__init__.py b/bots/modules/__init__.py index 207bd4f..df6f707 100644 --- a/bots/modules/__init__.py +++ b/bots/modules/__init__.py @@ -1,5 +1,5 @@ -from bots.modules.overlay import OverlayBotModuleConfig -from .channel_helper import ChannelHelperBotModuleConfig +from .overlay import OverlayBotModuleConfig +from .channel_helper import ChannelHelperBotModuleConfig, QueuedItem from .echo import EchoBotModuleConfig BOT_MODULES = [EchoBotModuleConfig, ChannelHelperBotModuleConfig, OverlayBotModuleConfig]