mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
blogpost/views no longer needed
This commit is contained in:
parent
1e04790d50
commit
75cc1eb2a8
|
@ -1,27 +0,0 @@
|
|||
from djangorestframework.modelresource import InstanceModelResource, ListOrCreateModelResource
|
||||
|
||||
from blogpost import models
|
||||
|
||||
BLOG_POST_FIELDS = ('created', 'title', 'slug', 'content', 'absolute_url', 'comment_url', 'comments_url')
|
||||
COMMENT_FIELDS = ('username', 'comment', 'created', 'rating', 'absolute_url', 'blogpost_url')
|
||||
|
||||
class BlogPosts(ListOrCreateModelResource):
|
||||
"""A resource with which lists all existing blog posts and creates new blog posts."""
|
||||
model = models.BlogPost
|
||||
fields = BLOG_POST_FIELDS
|
||||
|
||||
class BlogPostInstance(InstanceModelResource):
|
||||
"""A resource which represents a single blog post."""
|
||||
model = models.BlogPost
|
||||
fields = BLOG_POST_FIELDS
|
||||
|
||||
class Comments(ListOrCreateModelResource):
|
||||
"""A resource which lists all existing comments for a given blog post, and creates new blog comments for a given blog post."""
|
||||
model = models.Comment
|
||||
fields = COMMENT_FIELDS
|
||||
|
||||
class CommentInstance(InstanceModelResource):
|
||||
"""A resource which represents a single comment."""
|
||||
model = models.Comment
|
||||
fields = COMMENT_FIELDS
|
||||
|
Loading…
Reference in New Issue
Block a user