Skip to content

Introduction

We use Tastypie to handle our Django API. Please see backend/api/urls.py for all resources we have installed and to which api block.

Cubed has built a handful of custom classes to manage our config resources including dealing with 500 errors, and utilising Tastypie's CommanMeta approach and building our own Authorization and Authentication handlers.

Most classes can inherit from Tastypie's default ModelResource, but sometimes you will want to manage a specific error and in which case you will want to use the CubedModelResource which as some built in functionality for dealing with django/db exceptions and managing them in our own way.

For examples of both, go to backend/api/resources/config/client.py and review either EventResource (inherits CubedModelResource and uses AccountConfigCommonMeta), and EventDashResource (which inherits ModelResource).