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 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 ConversationShowReplyForm(Form): interest_id = HexField(source='url', filter=interest_opaque_to_id) parent_id = HexField(source='url', filter=conversation_opaque_to_id) id = HexField(source='url', filter=conversation_opaque_to_id)
class ConversationCreateReplyForm(ConversationCreateForm): parent_id = HexField(source='url', filter=conversation_opaque_to_id)
class InterestFollowersForm(Form): id = HexField(length=8, source='url', filter=interest_opaque_to_id) page = IntField(default=1, min=1) per_page = IntField(default=10, min=1, max=50)
class InterestIdForm(Form): id = HexField(length=8, source='url', filter=interest_opaque_to_id)