2019-01-19 06:52:00 +00:00
|
|
|
from django import forms
|
2019-01-11 19:16:01 +00:00
|
|
|
from django.forms import ModelForm
|
2019-01-19 06:52:00 +00:00
|
|
|
from djconfig.forms import ConfigForm
|
2019-01-11 19:16:01 +00:00
|
|
|
|
|
|
|
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
|
2019-01-19 06:52:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
class FeedsAppConfigForm(ConfigForm):
|
|
|
|
slug = 'feeds'
|
|
|
|
title = 'Feeds'
|
|
|
|
|
|
|
|
feed_bot_token = forms.CharField(required=True)
|
2019-01-26 06:36:56 +00:00
|
|
|
russian_proxy_string = forms.CharField()
|
2019-01-19 06:52:00 +00:00
|
|
|
vk_username = forms.CharField(required=True)
|
|
|
|
vk_password = forms.CharField(required=True)
|
2019-01-25 16:33:22 +00:00
|
|
|
vk_auth = forms.CharField(required=False, widget=forms.Textarea())
|