Ejemplo n.º 1
0
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'])
Ejemplo n.º 2
0
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'])
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
class InterestSearchForm(Form):
    query = StringField(minlength=1, maxlength=45, source='url')
Ejemplo n.º 7
0
class InterestCreateForm(Form):
    name = StringField(maxlength=45, source='form')
Ejemplo n.º 8
0
class UserShowForm(Form):
    name = StringField(regex=['^\w+$', 'accepts only alphanumerics'],
                       minlength=1,
                       maxlength=80,
                       source='url')