Example #1
0
def get_TextField(kwargs):
    """
    Returns a ``TextField``, applying the ``ndb.StringProperty`` length limit
    of 500 bytes.
    """
    kwargs['validators'].append(validators.length(max=500))
    return f.TextField(**kwargs)
Example #2
0
def convert_StringProperty(model, prop, kwargs):
    """Returns a form field for a ``db.StringProperty``."""
    if prop.multiline:
        kwargs['validators'].append(validators.length(max=500))
        return f.TextAreaField(**kwargs)
    else:
        return get_TextField(kwargs)
Example #3
0
 def convert_GenericProperty(self, model, prop, kwargs):
     """Returns a form field for a ``ndb.ListProperty``."""
     kwargs['validators'].append(validators.length(max=500))
     return get_TextField(kwargs)
Example #4
0
 def convert_StringProperty(self, model, prop, kwargs):
     """Returns a form field for a ``ndb.StringProperty``."""
     if prop._repeated:
         return StringListPropertyField(**kwargs)
     kwargs['validators'].append(validators.length(max=500))
     return get_TextField(kwargs)