# Path: reviews/views.py
# class PublicReviewView(BaseReview):
#     """Allows public access of some reviews."""
# 
#     template_name = "reviews/anonymous.html"
# 
#     def get_success_url(self):
#         return reverse('reviews:thanks')
# 
#     def dispatch(self, *args, **kwargs):
#         self.object = self.get_object()
#         if self.object and self.object.public and self.object.no_login:
#             return super(PublicReviewView, self).dispatch(*args, **kwargs)
#         raise Http404
# 
# class ReviewView(CustomerCheckMixin, ReviewMixin, BaseReview):
#     pass
# 
# class ReviewDatatableView(AdminMixin, CustomerListViewMixin, DatatableView):
#     model = Review
#     template_name = "reviews/review_list.html"
#     datatable_options = {
#         'structure_template': "datatableview/bootstrap_structure.html",
#         'columns': [
#             'title',
#             'sitting',
#             'quiz',
#             (_("Actions"), 'id', 'get_actions'),
#         ],
#         'search_fields': ['title', 'sitting__title'],
#         'unsortable_columns': ['id'],
#     }
#     review_type = None
# 
#     def get_queryset(self):
#         queryset = super(ReviewDatatableView, self).get_queryset()
#         return queryset.filter(userprofile=None)
# 
#     def get_actions(self, instance, *args, **kwargs):
#         return format_html(
#             '<a href="{}">Edit</a> | <a href="{}">Report</a>', reverse(
#                 'reviews:review_edit', args=[instance.pk]), reverse('reports:review', args=[instance.pk])
#         )
# 
# class PeerReviewDatatableView(AdminMixin, CustomerListViewMixin, DatatableView):
#     model = Review
#     template_name = "reviews/peer_review_list.html"
#     datatable_options = {
#         'structure_template': "datatableview/bootstrap_structure.html",
#         'columns': [
#             'title',
#             'sitting',
#             'quiz',
#             (_("User"), 'userprofile', 'get_user'),
#             (_("Actions"), 'id', 'get_actions'),
#         ],
#         'search_fields': ['title', 'userprofile__user__last_name', 'userprofile__user__first_name', 'userprofile__user__username', 'sitting__title'],
#         'unsortable_columns': ['id'],
#     }
#     review_type = None
# 
#     def get_queryset(self):
#         queryset = super(PeerReviewDatatableView, self).get_queryset()
#         return queryset.exclude(userprofile=None)
# 
#     def get_user(self, instance, *args, **kwargs):
#         return instance.userprofile.get_display_name()
# 
#     def get_actions(self, instance, *args, **kwargs):
#         return format_html(
#             '<a href="{}">Edit</a> | <a href="{}">Report</a>', reverse(
#                 'reviews:peer_review_edit', args=[instance.pk]), reverse('reports:peer_review', args=[instance.pk])
#         )
# 
# Path: reviews/views.py
# class BaseReview(FormMixin, DetailView):
# class ReviewView(CustomerCheckMixin, ReviewMixin, BaseReview):
# class PublicReviewView(BaseReview):
# class ReviewUpdate(AdminMixin, CustomerCheckMixin, CustomerSaveMixin, CustomerQuerysetMixin, UpdateView):
# class ReviewAdd(AdminMixin, CustomerSaveMixin, CustomerQuerysetMixin, CreateView):
# class ReviewDatatableView(AdminMixin, CustomerListViewMixin, DatatableView):
# class PeerReviewDatatableView(AdminMixin, CustomerListViewMixin, DatatableView):
# class TestReportView(CustomerCheckMixin, DetailView):
#     def get_success_url(self):
#     def get_form_class(self):
#     def post(self, request, *args, **kwargs):
#     def form_valid(self, form):
#     def form_invalid(self, form):
#     def get_context_data(self, **kwargs):
#     def dispatch(self, *args, **kwargs):
#     def get_success_url(self):
#     def dispatch(self, *args, **kwargs):
#     def get_queryset(self):
#     def get_actions(self, instance, *args, **kwargs):
#     def get_queryset(self):
#     def get_user(self, instance, *args, **kwargs):
#     def get_actions(self, instance, *args, **kwargs):
#     def get_context_data(self, **kwargs):
# 
# Path: reviews/views.py
# class TestReportView(CustomerCheckMixin, DetailView):
#     model = Review
#     template_name = "reviews/test_report.html"
# 
#     def get_context_data(self, **kwargs):
#         context = super(TestReportView, self).get_context_data(**kwargs)
#         context['report'] = calculate_multichoice_score(self.get_object())
#         return context


from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView
from reviews.views import PublicReviewView, ReviewView, ReviewDatatableView, PeerReviewDatatableView
from reviews.views import ReviewAdd, ReviewUpdate, PeerReviewUpdate, PeerReviewAdd
from reviews.views import TestReportView



urlpatterns = [
    url(r'^review/(?P<pk>\d+)/$', login_required(ReviewView.as_view()), name='review'),
    url(r'^anonymous/(?P<pk>\d+)/$', PublicReviewView.as_view(), name='anonymous_review'),
    url(r'^test-report/(?P<pk>\d+)/$', TestReportView.as_view(), name='test_report'),
    url(r'^reviews/add/$', login_required(ReviewAdd.as_view()), name='review_add'),
    url(r'^reviews/edit/(?P<pk>\d+)/$', login_required(ReviewUpdate.as_view()), name='review_edit'),
    url(r'^reviews/$', login_required(ReviewDatatableView.as_view()), name='review_list'),
    url(r'^peer-reviews/add/$', login_required(PeerReviewAdd), name='peer_review_add'),
    url(r'^peer-reviews/edit/(?P<pk>\d+)/$', login_required(PeerReviewUpdate), name='peer_review_edit'),
    url(r'^peer-reviews/$', login_required(PeerReviewDatatableView.as_view()), name='peer_review_list'),
    url(r'^thanks/$', TemplateView.as_view(template_name="reviews/thanks.html"), name='thanks'),

# Path: reviews/views.py
# class PublicReviewView(BaseReview):
#     """Allows public access of some reviews."""
# 
#     template_name = "reviews/anonymous.html"
# 
#     def get_success_url(self):
#         return reverse('reviews:thanks')
# 
#     def dispatch(self, *args, **kwargs):
#         self.object = self.get_object()
#         if self.object and self.object.public and self.object.no_login:
#             return super(PublicReviewView, self).dispatch(*args, **kwargs)
#         raise Http404
# 
# class ReviewView(CustomerCheckMixin, ReviewMixin, BaseReview):
#     pass
# 
# class ReviewDatatableView(AdminMixin, CustomerListViewMixin, DatatableView):
#     model = Review
#     template_name = "reviews/review_list.html"
#     datatable_options = {
#         'structure_template': "datatableview/bootstrap_structure.html",
#         'columns': [
#             'title',
#             'sitting',
#             'quiz',
#             (_("Actions"), 'id', 'get_actions'),
#         ],
#         'search_fields': ['title', 'sitting__title'],
#         'unsortable_columns': ['id'],
#     }
#     review_type = None
# 
#     def get_queryset(self):
#         queryset = super(ReviewDatatableView, self).get_queryset()
#         return queryset.filter(userprofile=None)
# 
#     def get_actions(self, instance, *args, **kwargs):
#         return format_html(
#             '<a href="{}">Edit</a> | <a href="{}">Report</a>', reverse(
#                 'reviews:review_edit', args=[instance.pk]), reverse('reports:review', args=[instance.pk])
#         )
# 
# class PeerReviewDatatableView(AdminMixin, CustomerListViewMixin, DatatableView):
#     model = Review
#     template_name = "reviews/peer_review_list.html"
#     datatable_options = {
#         'structure_template': "datatableview/bootstrap_structure.html",
#         'columns': [
#             'title',
#             'sitting',
#             'quiz',
#             (_("User"), 'userprofile', 'get_user'),
#             (_("Actions"), 'id', 'get_actions'),
#         ],
#         'search_fields': ['title', 'userprofile__user__last_name', 'userprofile__user__first_name', 'userprofile__user__username', 'sitting__title'],
#         'unsortable_columns': ['id'],
#     }
#     review_type = None
# 
#     def get_queryset(self):
#         queryset = super(PeerReviewDatatableView, self).get_queryset()
#         return queryset.exclude(userprofile=None)
# 
#     def get_user(self, instance, *args, **kwargs):
#         return instance.userprofile.get_display_name()
# 
#     def get_actions(self, instance, *args, **kwargs):
#         return format_html(
#             '<a href="{}">Edit</a> | <a href="{}">Report</a>', reverse(
#                 'reviews:peer_review_edit', args=[instance.pk]), reverse('reports:peer_review', args=[instance.pk])
#         )
# 
# Path: reviews/views.py
# class BaseReview(FormMixin, DetailView):
# class ReviewView(CustomerCheckMixin, ReviewMixin, BaseReview):
# class PublicReviewView(BaseReview):
# class ReviewUpdate(AdminMixin, CustomerCheckMixin, CustomerSaveMixin, CustomerQuerysetMixin, UpdateView):
# class ReviewAdd(AdminMixin, CustomerSaveMixin, CustomerQuerysetMixin, CreateView):
# class ReviewDatatableView(AdminMixin, CustomerListViewMixin, DatatableView):
# class PeerReviewDatatableView(AdminMixin, CustomerListViewMixin, DatatableView):
# class TestReportView(CustomerCheckMixin, DetailView):
#     def get_success_url(self):
#     def get_form_class(self):
#     def post(self, request, *args, **kwargs):
#     def form_valid(self, form):
#     def form_invalid(self, form):
#     def get_context_data(self, **kwargs):
#     def dispatch(self, *args, **kwargs):
#     def get_success_url(self):
#     def dispatch(self, *args, **kwargs):
#     def get_queryset(self):
#     def get_actions(self, instance, *args, **kwargs):
#     def get_queryset(self):
#     def get_user(self, instance, *args, **kwargs):
#     def get_actions(self, instance, *args, **kwargs):
#     def get_context_data(self, **kwargs):
# 
# Path: reviews/views.py
# class TestReportView(CustomerCheckMixin, DetailView):
#     model = Review
#     template_name = "reviews/test_report.html"
# 
#     def get_context_data(self, **kwargs):
#         context = super(TestReportView, self).get_context_data(**kwargs)
#         context['report'] = calculate_multichoice_score(self.get_object())
#         return context


# Path: reviews/urls.py
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView
from reviews.views import PublicReviewView, ReviewView, ReviewDatatableView, PeerReviewDatatableView
from reviews.views import ReviewAdd, ReviewUpdate, PeerReviewUpdate, PeerReviewAdd
from reviews.views import TestReportView




urlpatterns = [
    url(r'^review/(?P<pk>\d+)/$', login_required(ReviewView.as_view()), name='review'),
    url(r'^anonymous/(?P<pk>\d+)/$', PublicReviewView.as_view(), name='anonymous_review'),
    url(r'^test-report/(?P<pk>\d+)/$', TestReportView.as_view(), name='test_report'),
    url(r'^reviews/add/$', login_required(ReviewAdd.as_view()), name='review_add'),
    url(r'^reviews/edit/(?P<pk>\d+)/$', login_required(ReviewUpdate.as_view()), name='review_edit'),
    url(r'^reviews/$', login_required(ReviewDatatableView.as_view()), name='review_list'),
    url(r'^peer-reviews/add/$', login_required(PeerReviewAdd), name='peer_review_add'),
    url(r'^peer-reviews/edit/(?P<pk>\d+)/$', login_required(PeerReviewUpdate), name='peer_review_edit'),
    url(r'^peer-reviews/$', login_required(PeerReviewDatatableView.as_view()), name='peer_review_list'),
    url(r'^thanks/$', TemplateView.as_view(template_name="reviews/thanks.html"), name='thanks'),

]