python - Data Abstraction Layer between tastypie and Django ORM -


i have been entrusted creating api large existing codebase , have decided use tasypie. problem app structure.

we have database on top of djnago orm runs. app doesn't work directly orm though through set of methods (the data abstraction layer) handle things creating orm objects, validating them etc.

i hook tastypie said methods benefits of throttling, authentication etc. have no idea how that.

i've attempted write custom data source tastypie (like riak example have in docs) i'm thoroughly confused need override , each method does.

so, sum up:

  1. how go adding data abstraction layer between tastypie , orm?
  2. is using custom data source right way?
  3. how go creating such custom data source?

thanks.

yup, tasypie that. simple hook api calls directly django orm functionality. you'd use classes related django models subclasses of tasypie's modelresource, , ithandles things work fast out of box. people want more customized interface data abstarction layer there's way customize things. instead of using modelresource use resource classes instead , have set of methods have implement make them work data abstarction layer when different api calls made described in docs here:

http://django-tastypie.readthedocs.org/en/latest/resources.html

there 1 example given in docs how implement custom resources described under section called

using tastypie non-orm data sources ( i'd post link stack overflow limits me po

its not spelled out code doing unfortunately , explaination little thin imho example making custom interface non orm no sql database called riak. great if using riak, or if know riak, don't. found little confusing trying read code 2 new technologies , figuring code doing.

there's nice simpler example of using custom resource here made educational purposes connects api calls simple python classes :

https://gist.github.com/nomadjourney/794424

i not expert on tastypie @ in fact started it. need implement custom resource instead of using easy out of box modelresources. have not been able yet, thought i'd let know i've found. in tastypie docs mention folks wrote maintain active irc channel you. if you're still stuck might better stackoverflow if don't need here. luck, i'll try post example if 1 working best doug


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -