Skip to main content

A library to create forms in aiogram3

Project description

aiogram3-form

A library to create forms in aiogram3

Example

# suppose you import here your router and bot objects
from aiogram import types

from aiogram3_form import Form, FormField


class NameForm(Form):
    first_name: str = FormField(enter_message_text="Enter your first name please")
    second_name: str = FormField(enter_message_text="Enter your second name please")


@NameForm.submit()
async def name_form_submit_handler(form: NameForm, event_chat: types.Chat):
    await bot.send_message(
        event_chat.id, f"Your full name is {form.first_name} {form.second_name}!"
    )

After submit callback call the state would be automatically cleared.

You can control this state using the following metaclass kwarg

...


class NameForm(Form, clear_state_on_submit=False):  # True by default
    ...


@NameForm.submit()
async def name_form_submit_handler(form: NameForm, state: FSMContext):
    # so you can set your exit state manually
    await state.set_state(...)

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

aiogram3_form-0.0.5.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

aiogram3_form-0.0.5-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file aiogram3_form-0.0.5.tar.gz.

File metadata

  • Download URL: aiogram3_form-0.0.5.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.0 CPython/3.10.8 Windows/10

File hashes

Hashes for aiogram3_form-0.0.5.tar.gz
Algorithm Hash digest
SHA256 bf40e2e90241c22896aabd67414dbe574e1bfc8af80bda255649bcb659f0792f
MD5 e8c11a74531abc7ac7629cc5aebfd5c2
BLAKE2b-256 73b8618051da1791d961b62723b6d661b61147610d44b0038a4fdf63530d408b

See more details on using hashes here.

File details

Details for the file aiogram3_form-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: aiogram3_form-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.0 CPython/3.10.8 Windows/10

File hashes

Hashes for aiogram3_form-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5e26143b8cbe163269e8a174618c7b50cbeea0c398036b05393ff0f6119d3686
MD5 60a1e219a1744c463783ac90e09b1a99
BLAKE2b-256 adbdebfc3c09abf6fb3c4ed3dd87e357a87c69f336327e62548bb1c48566a58c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page