2011-02-19 13:26:27 +03:00
""" The root view for the examples provided with Django REST framework """
2012-02-22 00:47:55 +04:00
from djangorestframework . reverse 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 . . .
2012-08-25 22:53:10 +04:00
bash : curl - X GET http : / / shielded - mountain - 6732. herokuapp . com / # (Use default renderer)
bash : curl - X GET http : / / shielded - mountain - 6732. herokuapp . com / - H ' Accept: text/plain ' # (Use plaintext documentation renderer)
2011-02-19 13:26:27 +03:00
2011-12-29 17:31:12 +04:00
The examples provided :
2011-02-19 13:26:27 +03:00
1. A basic example using the [ Resource ] ( http : / / django - rest - framework . org / library / resource . html ) class .
2012-09-02 02:04:14 +04:00
2. A basic example using the [ ModelResource ] ( http : / / django - rest - framework . org / library / resource . html #resources.ModelResource) 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 ) :
2012-02-23 12:58:10 +04:00
return [ { ' name ' : ' Simple Resource example ' , ' url ' : reverse ( ' example-resource ' , request = request ) } ,
{ ' name ' : ' Simple ModelResource example ' , ' url ' : reverse ( ' model-resource-root ' , request = request ) } ,
{ ' name ' : ' Simple Mixin-only example ' , ' url ' : reverse ( ' mixin-view ' , request = request ) } ,
{ ' name ' : ' Object store API ' , ' url ' : reverse ( ' object-store-root ' , request = request ) } ,
{ ' name ' : ' Code highlighting API ' , ' url ' : reverse ( ' pygments-root ' , request = request ) } ,
{ ' name ' : ' Blog posts API ' , ' url ' : reverse ( ' blog-posts-root ' , request = request ) } ,
{ ' name ' : ' Permissions example ' , ' url ' : reverse ( ' permissions-example ' , request = request ) }
2011-06-20 03:10:25 +04:00
]