Adding new field types to a schema

0 views
Skip to first unread message

Matthew Scott

unread,
Jul 1, 2009, 3:17:06 PM7/1/09
to sch...@googlegroups.com
You can add new field types to a schema by creating a subclass of the field class you wish to extend, or by subclassing Field itself for a completely new data type.  Remember to grab field classes from the F namespace in the schema:

    class MySpecialFloat(F.Float):
        # ... implementation ...

When creating entities using the new type, use the lowercase_with_underscores version of the class name:

    class MyEntity(E.Entity):
        position = f.my_special_float()

Here's an example based loosely on an actual custom field used in a commercial app:


On Thu, Jun 25, 2009 at 06:57, erob <robillar...@gmail.com> wrote:
Moreover, can this be done only in SchevoGtk2 or should this kind of
extensions needs
adding new field types in the core Schevo package ?



--
Matthew R. Scott
Reply all
Reply to author
Forward
0 new messages