diff options
| author | Tom Christie | 2011-06-14 18:22:13 +0100 |
|---|---|---|
| committer | Tom Christie | 2011-06-14 18:22:13 +0100 |
| commit | 412b5fc2d54def2f2601b860b80afaa52d595e58 (patch) | |
| tree | b700e41c2d17a52d4726da7f62027c50f391b5e9 /examples/blogpost/urls.py | |
| parent | 323d52e7c44c208dce545a8084f7401384fd731e (diff) | |
| download | django-rest-framework-412b5fc2d54def2f2601b860b80afaa52d595e58.tar.bz2 | |
Support for nesting resources etc...
--HG--
rename : djangorestframework/tests/resources.py => djangorestframework/tests/serializer.py
Diffstat (limited to 'examples/blogpost/urls.py')
| -rw-r--r-- | examples/blogpost/urls.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/blogpost/urls.py b/examples/blogpost/urls.py index c677b8fa..6fde612e 100644 --- a/examples/blogpost/urls.py +++ b/examples/blogpost/urls.py @@ -11,9 +11,10 @@ class BlogPostResource(ModelResource): """ A Blog Post has a *title* and *content*, and can be associated with zero or more comments. """ - model = BlogPost - fields = ('created', 'title', 'slug', 'content', 'url', 'comments') - ordering = ('-created',) + class Meta: + model = BlogPost + fields = ('created', 'title', 'slug', 'content', 'url', 'comments') + ordering = ('-created',) def comments(self, instance): return reverse('comments', kwargs={'blogpost': instance.key}) @@ -23,9 +24,10 @@ class CommentResource(ModelResource): """ A Comment is associated with a given Blog Post and has a *username* and *comment*, and optionally a *rating*. """ - model = Comment - fields = ('username', 'comment', 'created', 'rating', 'url', 'blogpost') - ordering = ('-created',) + class Meta: + model = Comment + fields = ('username', 'comment', 'created', 'rating', 'url', 'blogpost') + ordering = ('-created',) urlpatterns = patterns('', |
