# Path: pyston/contrib/elasticsearch/resource.py
# class BaseElasticsearchResource(BaseModelResource):
# 
#     register = True
#     abstract = True
# 
#     allowed_methods = ('get', 'head', 'options')
#     serializer = ElasticsearchResourceSerializer
#     paginator = ElasticsearchOffsetBasedPaginator()
#     order_manager = ElasticsearchOrderManager()
#     filter_manager = ElasticsearchFilterManager()
# 
#     def _get_queryset(self):
#         return self.model.search()
# 
#     def _get_obj_or_none(self, pk=None):
#         if not pk:
#             return None
#         try:
#             return self.model.get(id=pk)
#         except NotFoundError:
#             return None
# 
# Path: example/dj/apps/app/elasticsearch/models.py
# class Comment(Document):
# 
#     user_id = Keyword()
#     content = Text()
#     is_public = Boolean()
#     priority = Integer()
# 
#     @property
#     def id(self):
#         return self.meta.id
# 
#     def __str__(self):
#         return self.id
# 
#     class Index:
#         name = 'comment'


from pyston.contrib.elasticsearch.resource import BaseElasticsearchResource
from .models import Comment



class CommentElasticsearchResource(BaseElasticsearchResource):

    model = Comment
    fields = (
        'id', 'user_id', 'content', 'is_public', 'priority'
    )


# Path: pyston/contrib/elasticsearch/resource.py
# class BaseElasticsearchResource(BaseModelResource):
# 
#     register = True
#     abstract = True
# 
#     allowed_methods = ('get', 'head', 'options')
#     serializer = ElasticsearchResourceSerializer
#     paginator = ElasticsearchOffsetBasedPaginator()
#     order_manager = ElasticsearchOrderManager()
#     filter_manager = ElasticsearchFilterManager()
# 
#     def _get_queryset(self):
#         return self.model.search()
# 
#     def _get_obj_or_none(self, pk=None):
#         if not pk:
#             return None
#         try:
#             return self.model.get(id=pk)
#         except NotFoundError:
#             return None
# 
# Path: example/dj/apps/app/elasticsearch/models.py
# class Comment(Document):
# 
#     user_id = Keyword()
#     content = Text()
#     is_public = Boolean()
#     priority = Integer()
# 
#     @property
#     def id(self):
#         return self.meta.id
# 
#     def __str__(self):
#         return self.id
# 
#     class Index:
#         name = 'comment'


# Path: example/dj/apps/app/elasticsearch/resource.py
from pyston.contrib.elasticsearch.resource import BaseElasticsearchResource
from .models import Comment




class CommentElasticsearchResource(BaseElasticsearchResource):

    model = Comment
    fields = (
        'id', 'user_id', 'content', 'is_public', 'priority'
    )


    can_read_obj = True