class UserCreateForm(Form): name = StringField(regex=['^\w+$', 'accepts only alphanumerics'], minlength=1, maxlength=80, source='form') email = EmailField(minlength=1, maxlength=120, source='form') password = StringField(source='form', minlength=3) avatar = FileField(required=False, extensions=['png', 'jpg', 'jpeg', 'gif'])
class UserUpdateForm(Form): name = StringField(required=False, minlength=1, maxlength=80, source='form') email = EmailField(required=False, minlength=1, maxlength=120, source='form') password = StringField(required=False, source='form') avatar = FileField(required=False, extensions=['png', 'jpg', 'jpeg', 'gif'])
class ConversationCreateForm(Form): interest_id = HexField(source='url', filter=interest_opaque_to_id) message = StringField(minlength=1, maxlength=2000, source='form') lat = FloatField(required=False, source='form') lon = FloatField(required=False, source='form') @property def location(self): if self.lat and self.lon: return [self.lat, self.lon] else: return None
class InterestIndexForm(Form): order = StringField(allowed=['recent', 'popular', 'distance'], default='popular') radius = IntField(required=False, min=1, max=100000) page = IntField(default=1, min=1) per_page = IntField(default=10, min=1, max=50) lat = FloatField(required=False, needs='lon') lon = FloatField(required=False, needs='lat') @property def location(self): if self.lat and self.lon: return [self.lat, self.lon] else: return None
class ConversationIndexForm(Form): interest_id = HexField(source='url', filter=interest_opaque_to_id) order = StringField(allowed=['recent', 'popular', 'distance'], default='popular') radius = IntField(required=False, min=1, max=100000) page = IntField(default=1, min=1) per_page = IntField(default=10, min=1, max=50) lat = FloatField(required=False, needs='lon') lon = FloatField(required=False, needs='lat') after = DateField(required=False, format='%Y-%m-%dT%H:%M:%S') @property def location(self): if self.lat and self.lon: return [self.lat, self.lon] else: return None
class InterestSearchForm(Form): query = StringField(minlength=1, maxlength=45, source='url')
class InterestCreateForm(Form): name = StringField(maxlength=45, source='form')
class UserShowForm(Form): name = StringField(regex=['^\w+$', 'accepts only alphanumerics'], minlength=1, maxlength=80, source='url')