telegram_bots/feeds/forms.py

36 lines
871 B
Python

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',
def get_config_form(mdl):
class ConfigForm(ModelForm):
prefix = 'config'
class Meta:
model = mdl
exclude = ()
return ConfigForm
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()