2011-01-30 21:30:39 +03:00
|
|
|
from django.conf.urls.defaults import patterns, url
|
2011-05-16 17:11:36 +04:00
|
|
|
from djangorestframework.views import ListOrCreateModelView, InstanceModelView
|
2011-06-15 17:09:01 +04:00
|
|
|
from modelresourceexample.resources import MyModelResource
|
2011-01-30 21:30:39 +03:00
|
|
|
|
2012-02-25 22:45:17 +04:00
|
|
|
my_model_list = ListOrCreateModelView.as_view(resource=MyModelResource)
|
|
|
|
my_model_instance = InstanceModelView.as_view(resource=MyModelResource)
|
|
|
|
|
2011-05-19 11:36:55 +04:00
|
|
|
urlpatterns = patterns('',
|
2012-02-25 22:45:17 +04:00
|
|
|
url(r'^$', my_model_list, name='model-resource-root'),
|
|
|
|
url(r'^(?P<id>[0-9]+)/$', my_model_instance, name='model-resource-instance'),
|
2011-01-30 21:30:39 +03:00
|
|
|
)
|