class MovieForm(wtforms.Form): title = UnicodeField(u'Title', [wtforms.validators.length(max=100)], description='The title of the movie') sort_title = UnicodeField( u'Sort Title', [wtforms.validators.length(max=100)], description='This will influence how the movie is sorted. (optional)') description = wtforms.TextAreaField( u'Description', description='A short description for the movie', ) date = wtforms.DateField( format='%Y-%m-%d', description='YYYY-MM-DD', ) length = UnicodeField( u'Length', [wtforms.validators.length(max=10)], description="HH:MM:SS", ) genres = CSVListField( u'Genres', description='Comma separated Genres', ) rating = wtforms.SelectField(u'Rating', choices=MOVIE_RATINGS) actors = CSVListField( u'Actors', description='Comma separated list of Actors (ex. Name1, Name2, Name3)') directors = CSVListField(u'Directors', description='Comma separated list of Directors') trailer_id = UnicodeField( u'Trailer ID', [wtforms.validators.length(max=20)], description="http://www.youtube.com/watch?v=<b>sftuxbvGwiU</b>", ) enabled = wtforms.BooleanField( u'Enabled', default=True, ) poster_url = wtforms.HiddenField(u'Poster URL', [ wtforms.validators.URL(require_tld=True, message=u'Invalid URL.'), wtforms.validators.Optional(), ])
class SeriesForm(wtforms.Form): title = UnicodeField( u'Title', [wtforms.validators.length(max=100)], description='The title of the series' ) seriestype = wtforms.SelectField( u'Series Type', choices=SERIES_TYPE, coerce=int, ) description = wtforms.TextAreaField( u'Description', description='A short description for the series', ) date = wtforms.DateField( format='%Y-%m-%d', description='YYYY-MM-DD - Release Date', ) genres = CSVListField( u'Genres', description='Comma separated Genres', ) rating = wtforms.SelectField(u'Rating', choices=SERIES_RATINGS) actors = CSVListField( u'Actors', description='Comma separated list of Actors (ex. Name1, Name2, Name3)' ) writers = CSVListField( u'Writers', description='Comma separated list of Writers' ) poster_url = UnicodeField( u'Poster URL', [ wtforms.validators.URL(require_tld=True, message=u'Invalid URL.'), wtforms.validators.Optional(), ], description=u'Enter the URL to a poster image', )
class MoviePosterForm(wtforms.Form): poster = UnicodeField( u'URL Link to Poster Image', [ wtforms.validators.URL(require_tld=True, message=u'Invalid URL.'), wtforms.validators.Regexp(r'.*\.(jpg|jpeg|gif|png)$', flags=2, message=u'Invalid input.') ], description='Please use http://amazon.com/ for artwork', )
class EpisodeBaseForm(wtforms.Form): selected = wtforms.BooleanField() title = UnicodeField(u'Title', [wtforms.validators.length(max=100)], description='The title of the Episode') description = wtforms.TextAreaField( u'Description', description='An optional episode description', )
class PasswordForm(wtforms.Form): # Must be different name than the Document model passwd = UnicodeField(u'Password', [ wtforms.validators.Optional(), wtforms.validators.length(max=50), wtforms.validators.EqualTo('confirm', message='Passwords must match') ], widget=wtforms.widgets.PasswordInput()) confirm = wtforms.PasswordField(u'Password Verify')
class SeasonForm(wtforms.Form): description = UnicodeField( u'Description', description='Summary of the season', ) date = wtforms.DateField( format='%Y', description='YYYY - Release Year', )
class UserForm(wtforms.Form): def __init__(self, *args, **kwargs): super(UserForm, self).__init__(*args, **kwargs) if kwargs.get('update', None): self['passwd'].validators.append(wtforms.validators.Optional()) self['passwd'].flags.required = False else: self['passwd'].validators.append(wtforms.validators.Required()) name = UnicodeField( u'Name', [wtforms.validators.Required(), wtforms.validators.length(max=75)], description='Enter full name of user', ) email = UnicodeField( u'E-mail', [wtforms.validators.Required(), wtforms.validators.length(max=50)], description='This will be the user\'s login', ) # Must be different name than the Document model passwd = UnicodeField(u'Password', [ wtforms.validators.length(max=50), wtforms.validators.EqualTo('confirm', message='Passwords must match') ], widget=wtforms.widgets.PasswordInput()) confirm = wtforms.PasswordField(u'Password Verify') usertype = wtforms.SelectField( u'User Type', choices=USER_TYPES, coerce=int, )
class EpisodeForm(EpisodeBaseForm): filename = UnicodeField() file = UnicodeField()
class MovieImportForm(MovieForm): selected = wtforms.BooleanField() filename = UnicodeField() file = UnicodeField()