dr.botzo/dr_botzo/markov/forms.py

37 lines
1.1 KiB
Python
Raw Normal View History

"""
markov/forms.py --- forms for manipulating markov data
"""
import logging
from django.forms import Form, CharField, FileField, ModelChoiceField
from markov.models import MarkovContext
log = logging.getLogger('dr_botzo.markov')
class LogUploadForm(Form):
"""Accept a file upload that will be imported into Markov stuff."""
log_file = FileField(help_text="Weechat log format.")
context = ModelChoiceField(queryset=MarkovContext.objects.all())
ignore_nicks = CharField(help_text="Comma-separated list of nicks to ignore.",
required=False)
strip_prefixes = CharField(help_text="Space-separated list of line prefixes to strip.",
required=False)
class TeachLineForm(Form):
"""Accept a line that will be imported into Markov stuff."""
context = ModelChoiceField(queryset=MarkovContext.objects.all())
line = CharField()
strip_prefixes = CharField(help_text="Space-separated list of line prefixes to strip.",
required=False)
# vi:tabstop=4:expandtab:autoindent