| 877 | | |
| 878 | | class Entity(object): |
| 879 | | ''' |
| 880 | | The base class for all entities |
| 881 | | |
| 882 | | All Elixir model objects should inherit from this class. Statements can |
| 883 | | appear within the body of the definition of an entity to define its |
| 884 | | fields, relationships, and other options. |
| 885 | | |
| 886 | | Here is an example: |
| | 878 | class EntityBase(object): |
| | 879 | """ |
| | 880 | This class holds all methods of the "Entity" base class, but does not act |
| | 881 | as a base class itself (it does not use the EntityMeta metaclass), but |
| | 882 | rather as a parent class for Entity. This is meant so that people who want |
| | 883 | to provide their own base class but don't want to loose or copy-paste all |
| | 884 | the methods of Entity can do so by inheriting from EntityBase: |
| 890 | | class Person(Entity): |
| 891 | | name = Field(Unicode(128)) |
| 892 | | birthdate = Field(DateTime, default=datetime.now) |
| 893 | | |
| 894 | | Please note, that if you don't specify any primary keys, Elixir will |
| 895 | | automatically create one called ``id``. |
| 896 | | |
| 897 | | For further information, please refer to the provided examples or |
| 898 | | tutorial. |
| 899 | | ''' |
| 900 | | __metaclass__ = EntityMeta |
| | 888 | class MyBase(EntityBase): |
| | 889 | __metaclass__ = EntityMeta |
| | 890 | |
| | 891 | def myCustomMethod(self): |
| | 892 | # do something great |
| | 893 | """ |
| | 1027 | |
| | 1028 | class Entity(EntityBase): |
| | 1029 | ''' |
| | 1030 | The base class for all entities |
| | 1031 | |
| | 1032 | All Elixir model objects should inherit from this class. Statements can |
| | 1033 | appear within the body of the definition of an entity to define its |
| | 1034 | fields, relationships, and other options. |
| | 1035 | |
| | 1036 | Here is an example: |
| | 1037 | |
| | 1038 | .. sourcecode:: python |
| | 1039 | |
| | 1040 | class Person(Entity): |
| | 1041 | name = Field(Unicode(128)) |
| | 1042 | birthdate = Field(DateTime, default=datetime.now) |
| | 1043 | |
| | 1044 | Please note, that if you don't specify any primary keys, Elixir will |
| | 1045 | automatically create one called ``id``. |
| | 1046 | |
| | 1047 | For further information, please refer to the provided examples or |
| | 1048 | tutorial. |
| | 1049 | ''' |
| | 1050 | __metaclass__ = EntityMeta |
| | 1051 | |
| | 1052 | |