Skip to main content

Forms for aiogram

Project description

aiogram-forms

PyPI - Python Version PyPI GitHub PyPI - Downloads

Introduction

aiogram-forms is an addition for aiogram which allows you to create different forms and process user input step by step easily.

Installation

pip install aiogram-forms

Usage

Create form you need by subclassing aiogram_forms.forms.Form. Fields can be added with aiogram_forms.fields.Field

from aiogram_forms import forms, fields
from aiogram.types import ReplyKeyboardMarkup, KeyboardButton


class UserForm(forms.Form):
    LANGUAGE_CHOICES = ('English', 'Russian', 'Chinese')
    LANGUAGE_KEYBOARD = ReplyKeyboardMarkup(resize_keyboard=True, row_width=3).add(*[
        KeyboardButton(label) for label in LANGUAGE_CHOICES
    ])

    name = fields.StringField('Name')
    language = fields.ChoicesField('Language', LANGUAGE_CHOICES, reply_keyboard=LANGUAGE_KEYBOARD)
    email = fields.EmailField('Email', validation_error_message='Wrong email format!')

History

All notable changes to this project will be documented in CHANGELOG file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiogram-forms-0.2.0.tar.gz (5.8 kB view hashes)

Uploaded source

Built Distribution

aiogram_forms-0.2.0-py3-none-any.whl (7.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page