Permalink
Browse files

API support added using tastypie module.

  • Loading branch information...
1 parent 468f014 commit a1f90667ed0bc5d08c864164b11cabce198f5066 @shantanoo shantanoo committed Mar 18, 2012
Showing with 19 additions and 0 deletions.
  1. +15 −0 shabdakosh/devanagari/api.py
  2. +4 −0 shabdakosh/urls.py
@@ -0,0 +1,15 @@
+from tastypie.resources import ModelResource
+from tastypie.constants import ALL, ALL_WITH_RELATIONS
+from devanagari.models import shabda
+
+
+class devanagari_shabda_resource(ModelResource):
+ class Meta:
+ queryset = shabda.objects.all()
+ resource_name = 'devanagari'
+ excludes = ['id', 'kiti_vela']
+ allowed_methods = ['get']
+ filtering = {
+ 'shabda': ALL,
+ }
+
View
@@ -1,4 +1,7 @@
from django.conf.urls.defaults import patterns, include, url
+from devanagari.api import devanagari_shabda_resource
+
+dsr = devanagari_shabda_resource()
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
@@ -14,4 +17,5 @@
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
+ url(r'^api/', include(dsr.urls)),
)

0 comments on commit a1f9066

Please sign in to comment.