diff options
| author | tom christie tom@tomchristie.com | 2011-02-19 10:26:27 +0000 |
|---|---|---|
| committer | tom christie tom@tomchristie.com | 2011-02-19 10:26:27 +0000 |
| commit | 805aa03ec1871f6a766d9052b348ddce9e9843c3 (patch) | |
| tree | 8ab5b6a7396236aa45bbc61e8404cc77fc75a9c5 /examples/mixin/urls.py | |
| parent | b749b950a1b4bede76b7e3900a6385779904902d (diff) | |
| download | django-rest-framework-805aa03ec1871f6a766d9052b348ddce9e9843c3.tar.bz2 | |
Yowzers. Final big bunch of refactoring for 0.1 release. Now support Django 1.3's views, admin style api is all polished off, loads of tests, new test project for running the test. All sorts of goodness. Getting ready to push this out now.
Diffstat (limited to 'examples/mixin/urls.py')
| -rw-r--r-- | examples/mixin/urls.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/mixin/urls.py b/examples/mixin/urls.py new file mode 100644 index 00000000..05009284 --- /dev/null +++ b/examples/mixin/urls.py @@ -0,0 +1,23 @@ +from djangorestframework.compat import View # Use Django 1.3's django.views.generic.View, or fall back to a clone of that if Django < 1.3 +from djangorestframework.emitters import EmitterMixin, DEFAULT_EMITTERS +from djangorestframework.response import Response + +from django.conf.urls.defaults import patterns, url +from django.core.urlresolvers import reverse + + +class ExampleView(EmitterMixin, View): + """An example view using Django 1.3's class based views. + Uses djangorestframework's EmitterMixin to provide support for multiple output formats.""" + emitters = DEFAULT_EMITTERS + + def get(self, request): + response = Response(200, {'description': 'Some example content', + 'url': reverse('mixin-view')}) + return self.emit(response) + + +urlpatterns = patterns('', + url(r'^$', ExampleView.as_view(), name='mixin-view'), +) + |
