fix bots admin and config form

This commit is contained in:
bakatrouble 2019-11-24 19:29:52 +03:00
parent 9d07c774a3
commit f309545196
3 changed files with 25 additions and 3 deletions

View File

@ -1,3 +1,14 @@
from django.contrib import admin 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)

View File

@ -1,3 +1,5 @@
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Fieldset
from django import forms from django import forms
from django.forms import ModelForm from django.forms import ModelForm
from djconfig.forms import ConfigForm from djconfig.forms import ConfigForm
@ -26,3 +28,12 @@ class BotsAppConfigForm(ConfigForm):
title = 'Bots' title = 'Bots'
tmp_uploads_chat_id = forms.CharField(required=True) 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'),
)

View File

@ -1,5 +1,5 @@
from bots.modules.overlay import OverlayBotModuleConfig from .overlay import OverlayBotModuleConfig
from .channel_helper import ChannelHelperBotModuleConfig from .channel_helper import ChannelHelperBotModuleConfig, QueuedItem
from .echo import EchoBotModuleConfig from .echo import EchoBotModuleConfig
BOT_MODULES = [EchoBotModuleConfig, ChannelHelperBotModuleConfig, OverlayBotModuleConfig] BOT_MODULES = [EchoBotModuleConfig, ChannelHelperBotModuleConfig, OverlayBotModuleConfig]