Page MenuHomec4science

pages_number_field.py
No OneTemporary

File Metadata

Created
Fri, Nov 8, 01:19

pages_number_field.py

from wtforms import TextField
__all__ = ['PagesNumberField']
class PagesNumberField(TextField):
def __init__(self, **kwargs):
self._icon_html = '<i class="icon-th"></i>'
super(PagesNumberField, self).__init__(**kwargs)
def pre_validate(self):
value = self.data
def is_number(s):
try:
float(s)
return True
except ValueError:
return False
if not is_number(value):
return dict(error=1, \
error_message='Pages number must be a number! duh')
def autocomplete(self):
return []

Event Timeline