Tastypie- Append parameters to URI

后端 未结 1 673
有刺的猬
有刺的猬 2021-01-27 11:57

How do I append parameters to a URL in Django Tastypie.

Here is url.py.

from modules.actions.views import InstallationResource,ApiActionsResource
from t         


        
相关标签:
1条回答
  • 2021-01-27 12:07

    You need to include your api urls like this:

    urlpatterns = patterns(''`,
        (r'^api/', include(v1_api.urls)),
    )
    

    Make sure that you've set your resource name:

    class ApiActionsResource(Resource):
    
        class Meta:
            resource_name = 'action_type'
    

    After that, you can access any resourse in a rest way, using the resource name. In your case that would be: '/api/v1/action_type/1'

    It's all explained under http://django-tastypie.readthedocs.org/en/latest/interacting.html.

    0 讨论(0)
提交回复
热议问题