Forms for aiogram
Project description
aiogram-forms
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. For more examples refer to examples folder.
class UserProfileForm(forms.Form):
"""Example of user details form."""
# Simple field usage
name = fields.StringField('Name')
# Using custom validators
username = fields.StringField(
'Username', validators=[validators.RegexValidator(r'^[a-z0-9_-]{3,15}$')]
)
# Custom reply keyboard with validation
language = fields.ChoicesField(
'Language', LANGUAGE_CHOICES, reply_keyboard=LANGUAGE_KEYBOARD
)
# Custom validation message
email = fields.EmailField(
'Email', validation_error_message='Wrong email format!'
)
# Allow user to share contact as reply
phone = fields.PhoneNumberField(
'Phone', share_contact=True, share_contact_label='Share your contact'
)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiogram_forms-0.3.0.tar.gz.
File metadata
- Download URL: aiogram_forms-0.3.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.6 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
074b43b78ae341c53d9b71428504b0fa80032e1610461bbab22be1dc2aac9fb3
|
|
| MD5 |
93f6c87e9917cca27445791f61f340f5
|
|
| BLAKE2b-256 |
df6332aeb382d51171ee1bdcccb03415a406d892bc414c6703ee0ecf290e9a4f
|
File details
Details for the file aiogram_forms-0.3.0-py3-none-any.whl.
File metadata
- Download URL: aiogram_forms-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.6 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b90e145a62636309aea1a43137d34685c53393a92d10e3ba61f6538b5fd3bb97
|
|
| MD5 |
f4069d84feadacc9ef136a28223cfe06
|
|
| BLAKE2b-256 |
95428b632fd1d7fe360ebe33386eacbd0bc79e3bb74bb6be073f5398d10c6b4e
|