Skip to main content

Layrz forms and tools for Python

Project description

Layrz Forms

PyPI GitHub license

A collection of tools that we use to make django developers life easier. I hope you find them useful too.

Tired of complex forms validations? The default Django schema is too complex? Layrz Forms is for you! Works like Django Forms but with a simpler API and more features. Highly personalizable and extensible, you can use it in your projects without any problem.

import layrz_forms as forms


class ExampleForm(forms.Form):
  """ Example form """
  id_test = forms.IdField(required=True)
  email_text = forms.EmailField(required=True)
  json_list_test = forms.JsonField(required=True, datatype=list)
  json_dict_test = forms.JsonField(required=True, datatype=dict)
  int_test = forms.NumberField(required=True, datatype=int, min_value=0, max_value=5)
  float_test = forms.NumberField(required=True, datatype=float, min_value=0, max_value=5)
  bool_test = forms.BooleanField(required=True)
  plain_text_test = forms.CharField(required=True, empty=False)
  empty_text_test = forms.CharField(required=True, empty=True)
  range_text_test = forms.CharField(required=True, empty=False, min_length=5, max_length=10)

  def clean_func1(self):
    """ Print clean """
    self.add_errors(key='clean1', code='error1')
    self.add_errors(key='clean1', code='error2')

  def clean_func2(self):
    self.add_errors(key='clean2', code='error1')


if __name__ == '__main__':
  obj = {
    'id_test': 1,
    'email_text': 'example@goldenmcorp.com',
    'json_dict_test': {
      'hola': 'mundo'
    },
    'json_list_test': ['hola mundo'],
    'int_test': 5,
    'float_test': 4.5,
    'bool_test': True,
    'plain_text_test': 'hola mundo',
    'empty_text_test': 'hola',
    'range_text_test': 'hola'
  }

  form = ExampleForm(obj)

  print('form.is_valid():', form.is_valid())
  #> form.is_valid(): None
  print('form.errors():', form.errors())
  #> form.errors(): {'rangeTextTest': [{'code': 'minLength', 'expected': 5, 'received': 4}], 'clean1': [{'code': 'error1'}, {'code': 'error2'}], 'clean2': [{'code': 'error1'}]}

FAQ

Do you have other libraries?

Of course! We have multiple libraries (for Layrz or general purpose) that you can use in your projects, you can find us on PyPi of Golden M or PyPi of Layrz for Python libraries, RubyGems for Ruby gems, NPM of Golden M or NPM of Layrz for NodeJS libraries or here in Pub.dev for Dart/Flutter libraries.

I need to pay to use this package?

No! This library is free and open source, you can use it in your projects without any cost, but if you want to support us, give us an star on our Repository!

Can I contribute to this package?

Yes! We are open to contributions, feel free to open a pull request or an issue on the Repository!

I have a question, how can I contact you?

If you need more assistance, you open an issue on the Repository and we're happy to help you :)

License

This project is licensed under the MIT License - see the LICENSE file for details.

This project is maintained by Golden M with authorization of Layrz LTD.

Who are you? / Want to work with us?

Golden M is a software and hardware development company what is working on a new, innovative and disruptive technologies. For more information, contact us at sales@goldenm.com or via WhatsApp at +(507)-6979-3073.

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

layrz_forms-2.1.9.tar.gz (44.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

layrz_forms-2.1.9-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file layrz_forms-2.1.9.tar.gz.

File metadata

  • Download URL: layrz_forms-2.1.9.tar.gz
  • Upload date:
  • Size: 44.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for layrz_forms-2.1.9.tar.gz
Algorithm Hash digest
SHA256 093add3850ead4c2d9e7335e2f4b5d8c53f6630ccd981308f3759bc4d691cb03
MD5 b4b4eea09dfa95e4bd93b705ecd50f56
BLAKE2b-256 967d7a746e0a8d840af6fe09bafab13a84bd7e8a11140f7bf99dea639f2dae32

See more details on using hashes here.

File details

Details for the file layrz_forms-2.1.9-py3-none-any.whl.

File metadata

  • Download URL: layrz_forms-2.1.9-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for layrz_forms-2.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 4d16c9fc2e004a07ed9f252ad15366fff80346698a3db0f1dbbccb1d6fd12c32
MD5 8d866304adacfb306d1f659d17cf69b5
BLAKE2b-256 c7a7d9dca995767602c8a36dd5b81c1648427bf5aa66f5da42a241d9b76a1c0e

See more details on using hashes here.

Supported by

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