# Path: app/blog_lab/cbv/views.py
# class ArticleDetailView(JsonResponseMixin, DetailView):
#     model = Article
#     datetime_type = 'timestamp'
#     many = True
#     foreign = True
#     exclude_attr = ('comments', )
#     fields = ['caption', 'content', 'classification', 'tags']
#     queryset = Article.objects.all()
#     # slug_url_kwarg = '32'
#     pk_url_kwarg = 'id'
#     success_url = '/'
#     # context_object_name = 'article_list'
#     # queryset = Article.objects.filter(publish=False)
#     # ordering = '-create_time'
#     # paginate_orphans = 1
#     paginate_by = 2
#     # slug_field = 'id'
#     template_name = 'test_cbv.html'
#     # http_method_names = [u'get', u'post', u'put', u'patch', u'delete', u'head', u'options', u'trace', u'link']
# 
# 
#     def get_context_data(self, **kwargs):
#         context = super(ArticleDetailView, self).get_context_data(**kwargs)
#         context['now'] = timezone.now()
#         print context
#         # print context['page_obj'].paginator.page_range
#         return context
#     #
#     # # def get_object(self, queryset=None):
#     # #     return Article.objects.get(id=32)
#     #
#     # def get(self, request, *args, **kwargs):
#     #     self.kwargs['id'] = u'32'
#     #     return super(ArticleDetailView, self).get(request, *args, **kwargs)
#         #
#         # # def get(self, request, *args, **kwargs):
#         # #     obj = self.get_object()
#         # #     json_obj = model_serializer(obj, serializer='json')
#         # #     return HttpResponse(json_obj, content_type='application/json')
#         #
#         # def delete(self, request, *args, **kwargs):
#         #     return HttpResponse('delete')
#         #
#         # def post(self, request, *args, **kwargs):
#         #     return HttpResponse('post')
#         #
#         # def link(self, request, *args, **kwargs):
#         #     return HttpResponse('link')
# 
# def test(req):
#     article_list = Article.objects.all()
#     article = article_list[0]
#     # print article._meta.get_all_field_names()
#     # print getattr(article, 'tags').all()[0].tags_art.all()
#     json_data = serializer(article, datetime_format='timestamp', output_type='json', deep=True, many=True, exclude_attr=['comments','tags'])
#     return HttpResponse(json_data, content_type='application/json')


from django.conf.urls import patterns, url
from app.blog_lab.proxy.views import create_permission, get_ip
from app.blog_lab.chart.views import get_chart_message
from app.blog_lab.views import *
from app.blog_lab.cbv.views import ArticleDetailView, test



urlpatterns = patterns('',
    url(r'^create_token/$', create_permission),
    url(r'^get_proxy/$', get_ip),
    url(r'^proxy/$', proxy),
    url(r'^monitor/$', monitor),
    url(r'^get_lab_info/$', get_lab_info),
    url(r'^get_chart_info/$', get_chart_message),
    url(r'^hy/$', hy_sign),

# Path: app/blog_lab/cbv/views.py
# class ArticleDetailView(JsonResponseMixin, DetailView):
#     model = Article
#     datetime_type = 'timestamp'
#     many = True
#     foreign = True
#     exclude_attr = ('comments', )
#     fields = ['caption', 'content', 'classification', 'tags']
#     queryset = Article.objects.all()
#     # slug_url_kwarg = '32'
#     pk_url_kwarg = 'id'
#     success_url = '/'
#     # context_object_name = 'article_list'
#     # queryset = Article.objects.filter(publish=False)
#     # ordering = '-create_time'
#     # paginate_orphans = 1
#     paginate_by = 2
#     # slug_field = 'id'
#     template_name = 'test_cbv.html'
#     # http_method_names = [u'get', u'post', u'put', u'patch', u'delete', u'head', u'options', u'trace', u'link']
# 
# 
#     def get_context_data(self, **kwargs):
#         context = super(ArticleDetailView, self).get_context_data(**kwargs)
#         context['now'] = timezone.now()
#         print context
#         # print context['page_obj'].paginator.page_range
#         return context
#     #
#     # # def get_object(self, queryset=None):
#     # #     return Article.objects.get(id=32)
#     #
#     # def get(self, request, *args, **kwargs):
#     #     self.kwargs['id'] = u'32'
#     #     return super(ArticleDetailView, self).get(request, *args, **kwargs)
#         #
#         # # def get(self, request, *args, **kwargs):
#         # #     obj = self.get_object()
#         # #     json_obj = model_serializer(obj, serializer='json')
#         # #     return HttpResponse(json_obj, content_type='application/json')
#         #
#         # def delete(self, request, *args, **kwargs):
#         #     return HttpResponse('delete')
#         #
#         # def post(self, request, *args, **kwargs):
#         #     return HttpResponse('post')
#         #
#         # def link(self, request, *args, **kwargs):
#         #     return HttpResponse('link')
# 
# def test(req):
#     article_list = Article.objects.all()
#     article = article_list[0]
#     # print article._meta.get_all_field_names()
#     # print getattr(article, 'tags').all()[0].tags_art.all()
#     json_data = serializer(article, datetime_format='timestamp', output_type='json', deep=True, many=True, exclude_attr=['comments','tags'])
#     return HttpResponse(json_data, content_type='application/json')


# Path: app/blog_lab/urls.py
from django.conf.urls import patterns, url
from app.blog_lab.proxy.views import create_permission, get_ip
from app.blog_lab.chart.views import get_chart_message
from app.blog_lab.views import *
from app.blog_lab.cbv.views import ArticleDetailView, test




urlpatterns = patterns('',
    url(r'^create_token/$', create_permission),
    url(r'^get_proxy/$', get_ip),
    url(r'^proxy/$', proxy),
    url(r'^monitor/$', monitor),
    url(r'^get_lab_info/$', get_lab_info),
    url(r'^get_chart_info/$', get_chart_message),
    url(r'^hy/$', hy_sign),

    url(r'^get_test_cbv/(?P<id>(\d)+)/$', ArticleDetailView.as_view()),