The perfect counterpart to django-tastypie.
django-whippedcream provides a few mixins and utilities that I’ve used to make my life with tastypie easier.
Tested using django-tastypie>0.12, Django>1.7, and Python 2.7 and >3.4
Requirements
django-tastypie, of course. Also pytz if you want to use the DateTimeSerializer.
Installation
Install: pip install django-whippedcream
Add whippedcream to your INSTALLED_APPS.
DateTimeField
This is a simple addition to the DateTimeField that removes milliseconds from the field. This is useful if you don’t want to provide that level of accuracy, but also if your database engine doesn’t store that level of accuracy (MySQL).
from whippedcream.fields import DateTimeField
class MyResource(Resource):
dt = DateTimeField('dt', normalize=True)
PyAccessMixin
This mixin class can be added to any resource where you may want to access a serialized (JSON) version in any of your regular python code. It basically implements this pattern:
http://django-tastypie.readthedocs.org/en/latest/cookbook.html#using-your-resource-in-regular-views
from whippedcream.mixins import PyAccessMixin
class MyResource(MyAccessMixin, Resource):
pass
# elsewhere...
result = MyResource().obj_to_simple(request, obj)
Metadata
Release files for django-whippedcream 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-whippedcream-0.2.2.tar.gz | 8.1 kB | Details |
Release files / django-whippedcream-0.2.2.tar.gz
| Download URL | django-whippedcream-0.2.2.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09d01922ec69569f89ba81392a4bb72f8028f66f3685657cccd0d19b970fe06c
|
|
BLAKE2b-256 checksum How to use checksums |
bf31700bcb7b1e9ec7f743ea856308a29057ff60acdb1220a8633ec788454175
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |