Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The benefits of tasty-pie (or any similar framework) stem from designing your code in a RESTful way. In this case, making your models resources.</p> <p>In the case you've presented, <em>it's not evident how you've integrated tasty-pie into your project</em>, which may explain your confusion around the benefits of tasty-pie (or similar frameworks).</p> <p><code>AlbumImage</code> would be a good candidate for a <a href="http://django-tastypie.readthedocs.org/en/latest/tutorial.html#creating-resources" rel="nofollow">resource</a>:</p> <pre><code>class AlbumImageResource(ModelResource): class Meta: queryset = AlbumImage.objects.all() resource_name = 'album_image' </code></pre> <p>... then, any <code>AlbumImageResource</code> could be have a <a href="http://django-tastypie.readthedocs.org/en/latest/tutorial.html#creating-resources" rel="nofollow">URI registered</a> ...</p> <pre><code>from myapp.api import AlbumImageResource album_resource = EntryResource() urlpatterns = patterns('', # The normal jazz here... (r'^api/', include(album_resource.urls)), ) </code></pre> <p>... and it can be accessed via that URI, in any format:</p> <pre><code>curl -H "Accept: application/json" http://127.0.0.1:8000/api/album_image/ </code></pre> <p>Then, you have a RESTful system that can access content via URIs.</p> <p>In fact, the documentation <a href="http://django-tastypie.readthedocs.org/en/latest/tutorial.html#limiting-data-and-access" rel="nofollow">even provides ways to limit access</a>, and <a href="http://django-tastypie.readthedocs.org/en/latest/resources.html" rel="nofollow">advanced ways to filter and sort data</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload