You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.5 KiB

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', 'config_type', 'config_id', 'last_check',
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('', 'russian_proxy_string', 'vk_username', 'vk_password', 'vk_auth', 'anticaptcha_token'),
Fieldset('Twitter', 'twitter_consumer_api_key', 'twitter_consumer_api_secret', 'twitter_access_token',