2011-02-19 13:26:27 +03:00
""" The root view for the examples provided with Django REST framework """
from django . core . urlresolvers import reverse
2011-05-24 13:27:24 +04:00
from djangorestframework . views import View
2011-02-19 13:26:27 +03:00
2011-05-24 13:27:24 +04:00
class Sandbox ( View ) :
2011-02-19 13:26:27 +03:00
""" This is the sandbox for the examples provided with [Django REST framework](http://django-rest-framework.org).
2011-12-13 01:20:09 +04:00
These examples are provided to help you get a better idea of some of the features of RESTful APIs created using the framework .
2011-02-19 13:26:27 +03:00
All the example APIs allow anonymous access , and can be navigated either through the browser or from the command line . . .
2011-04-28 22:54:30 +04:00
bash : curl - X GET http : / / api . django - rest - framework . org / # (Use default renderer)
bash : curl - X GET http : / / api . django - rest - framework . org / - H ' Accept: text/plain ' # (Use plaintext documentation renderer)
2011-02-19 13:26:27 +03:00
The examples provided :
1. A basic example using the [ Resource ] ( http : / / django - rest - framework . org / library / resource . html ) class .
2. A basic example using the [ ModelResource ] ( http : / / django - rest - framework . org / library / modelresource . html ) class .
2011-04-28 22:54:30 +04:00
3. An basic example using Django 1.3 ' s [class based views](http://docs.djangoproject.com/en/dev/topics/class-based-views/) and djangorestframework ' s [ RendererMixin ] ( http : / / django - rest - framework . org / library / renderers . html ) .
2011-02-19 13:26:27 +03:00
4. A generic object store API .
5. A code highlighting API .
6. A blog posts and comments API .
2011-06-26 03:38:56 +04:00
7. A basic example using permissions .
2011-02-19 13:26:27 +03:00
Please feel free to browse , create , edit and delete the resources in these examples . """
2011-04-27 21:07:28 +04:00
def get ( self , request ) :
2011-02-19 13:26:27 +03:00
return [ { ' name ' : ' Simple Resource example ' , ' url ' : reverse ( ' example-resource ' ) } ,
2011-05-16 17:11:36 +04:00
{ ' name ' : ' Simple ModelResource example ' , ' url ' : reverse ( ' model-resource-root ' ) } ,
2011-02-19 13:26:27 +03:00
{ ' name ' : ' Simple Mixin-only example ' , ' url ' : reverse ( ' mixin-view ' ) } ,
{ ' name ' : ' Object store API ' , ' url ' : reverse ( ' object-store-root ' ) } ,
{ ' name ' : ' Code highlighting API ' , ' url ' : reverse ( ' pygments-root ' ) } ,
2011-06-20 03:10:25 +04:00
{ ' name ' : ' Blog posts API ' , ' url ' : reverse ( ' blog-posts-root ' ) } ,
2011-06-25 18:38:16 +04:00
{ ' name ' : ' Permissions example ' , ' url ' : reverse ( ' permissions-example ' ) }
2011-06-20 03:10:25 +04:00
]