Skip to content

Commit

Permalink
Update README with list of current field types
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Ambra committed Sep 20, 2017
1 parent f80636b commit 8ea2273
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Person(models.DeclarativeBase):
last_name = fields.StringField()
join_date = fields.DateTimeField()
# See fields.py for a complete list of fields
me = Person()
me.first_name = "Joe"
me.last_name = "Somebody"
Expand All @@ -37,6 +37,17 @@ me.join_date = datetime.datetime.now()
json.dumps(me)
```

## Field Types

* DeclarativeField - Base field type. Make your own types by inheriting from this.
* GenericField - Passes values through with no parsing or encoding.
* StringField - Sends and receives strings. Coerces to string if necessary.
* UUIDField - Sends and receives UUIDs and UUID v4-formatted strings.
* DateTimeField - Sends and receives datetime objects. Parses using python-dateutil.
* DateField - Sends and receives date objects. Parses using python-dateutil and can accept a datetime.
* TimeField - Sends and receives time objects. Can accept a datetime.
* JSONField - Sends and receives JSON objects. Must be able to be loaded and encoded through json.loads and json.dumps.

The normal use case for declarative models and fields is for ORMs and business objects. You could use it for APIs and SDKs, or to pass data between systems via JSON. All JSON encoding is done automatically based on the field type you use.

If you need a new field or have a suggestion, please create an issue or PR!
If you need a new field or have a suggestion, please create an issue or PR!

0 comments on commit 8ea2273

Please sign in to comment.