Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
Fields with an input mask¶
This document describes and tests the
mask_re option of a lino.core.fields.CharField
.
We define a single model:
from django.db import models
from lino.api import dd
class Foo(dd.Model):
name = models.CharField(max_length=100, blank=True)
remarks = models.TextField("Remarks", blank=True)
input_mask_test = dd.CharField(
"Input mask test",
blank=True,
max_length=200,
help_text="""This field is here to play with the
CharField parameters regex, mask_re and strip_chars_re.
By default it accepts all letters except Z.
""",
#~ regex='/^[a-yA-Y]*$/')
mask_re='/^[a-yA-Y]*$/')
#~ strip_chars_re='/^[a-yA-Y]*$/')
class Foos(dd.Table):
model = Foo
column_names = 'name input_mask_test id remarks'
detail_layout = """
id name input_mask_test
remarks
"""
insert_layout = """
name
input_mask_test
"""
This field is here to play with the CharField parameters regex, mask_re and strip_chars_re. By default it accepts all letters except Z.
How to try this:
$ cd docs/tutorials/input_mask
$ pm prep
$ pm runserver