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 from feeds.models import Feed class FeedForm(ModelForm): prefix = 'feed' class Meta: model = Feed exclude = 'owner', 'lock', 'config_type', 'config_id', 'last_check', 'last_id', class FeedsAppConfigForm(ConfigForm): slug = 'feeds' title = 'Feeds' feed_bot_token = forms.CharField(required=True) russian_proxy_string = forms.CharField() vk_username = forms.CharField(required=True) vk_password = forms.CharField(required=True) vk_auth = forms.CharField(required=False, widget=forms.Textarea()) anticaptcha_token = forms.CharField() twitter_consumer_api_key = forms.CharField() twitter_consumer_api_secret = forms.CharField() twitter_access_token = forms.CharField() twitter_access_token_secret = forms.CharField() 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', 'feed_bot_token'), Fieldset('VK.com', 'russian_proxy_string', 'vk_username', 'vk_password', 'vk_auth', 'anticaptcha_token'), Fieldset('Twitter', 'twitter_consumer_api_key', 'twitter_consumer_api_secret', 'twitter_access_token', 'twitter_access_token_secret'), )