# Path: survey/settings.py
# SLUG_RE = r'[a-zA-Z0-9-]+'
# 
# Path: survey/views/matrix.py
# class MatrixListView(MatrixQuerysetMixin, ListView):
# 
#     template_name = "survey/matrix/index.html"
# 
#     def get_context_data(self, **kwargs):
#         context = super(MatrixListView, self).get_context_data(**kwargs)
#         url_kwargs = self.get_url_kwargs()
#         context.update({
#             'editable_filter_api': reverse('editable_filter_api',
#                 kwargs=url_kwargs),
#             'matrix_api_base': reverse(
#                 'matrix_api_base', kwargs=url_kwargs),
#         })
#         return context
# 
# class MatrixDetailView(MatrixMixin, DetailView):
# 
#     template_name = "survey/matrix/matrix.html"
# 
#     def get_cohorts(self):
#         """
#         Returns the list of cohorts shown in the Matrix decorated
#         with ``is_selected`` for cohorts the user shows.
#         """
#         selected = list(self.object.cohorts.all())
#         cohorts = EditableFilter.objects.filter(tags='cohort')
#         for cohort in cohorts:
#             if cohort in selected:
#                 cohort.is_selected = True
#         return cohorts
# 
#     def get_context_data(self, **kwargs):
#         context = super(MatrixDetailView, self).get_context_data(**kwargs)
#         metrics = EditableFilter.objects.filter(tags='metric')
#         for metric in metrics:
#             if metric == self.object.metric:
#                 metric.is_selected = True
#         url_kwargs = {'editable_filter': ''}
#         url_kwargs.update(self.get_url_kwargs())
#         context.update({
#             'cohorts': self.get_cohorts(),
#             'metrics': metrics,
#             'editable_filter_api_base': reverse('editable_filter_api',
#                 kwargs=url_kwargs),
#         })
#         url_kwargs = {self.matrix_url_kwarg: str(self.object)}
#         url_kwargs.update(self.get_url_kwargs())
#         context.update({
#             'matrix_api': reverse('matrix_api', kwargs=url_kwargs),
#         })
#         return context
# 
#     def get_object(self, queryset=None):
#         if queryset is None:
#             queryset = self.get_queryset()
#         return get_object_or_404(
#             queryset, slug=self.kwargs.get(self.matrix_url_kwarg))
# 
#     def get_template_names(self):
#         names = super(MatrixDetailView, self).get_template_names()
#         names.insert(0, "survey/matrix/%s.html" % self.object.slug)
#         return names
# 
# class AccountListView(EditableFilterView):
# 
#     api_url = 'survey_api_accounts_filter'
# 
# class QuestionListView(EditableFilterView):
# 
#     api_url = 'survey_api_questions_filter'


from django.conf.urls import url
from ..settings import SLUG_RE
from ..views.matrix import (MatrixListView, MatrixDetailView,
    AccountListView, QuestionListView)
# 1. Redistributions of source code must retain the above copyright notice,
#    this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.




urlpatterns = [
   url(r'^accounts/(?P<editable_filter>%s)/?' % SLUG_RE,
       AccountListView.as_view(), name='accounts_list'),
   url(r'^accounts/',
       AccountListView.as_view(), name='accounts_base'),
   url(r'^questions/(?P<editable_filter>%s)/?' % SLUG_RE,
       QuestionListView.as_view(), name='questions_list'),
   url(r'^questions/',
       QuestionListView.as_view(), name='questions_base'),

# Path: survey/settings.py
# SLUG_RE = r'[a-zA-Z0-9-]+'
# 
# Path: survey/views/matrix.py
# class MatrixListView(MatrixQuerysetMixin, ListView):
# 
#     template_name = "survey/matrix/index.html"
# 
#     def get_context_data(self, **kwargs):
#         context = super(MatrixListView, self).get_context_data(**kwargs)
#         url_kwargs = self.get_url_kwargs()
#         context.update({
#             'editable_filter_api': reverse('editable_filter_api',
#                 kwargs=url_kwargs),
#             'matrix_api_base': reverse(
#                 'matrix_api_base', kwargs=url_kwargs),
#         })
#         return context
# 
# class MatrixDetailView(MatrixMixin, DetailView):
# 
#     template_name = "survey/matrix/matrix.html"
# 
#     def get_cohorts(self):
#         """
#         Returns the list of cohorts shown in the Matrix decorated
#         with ``is_selected`` for cohorts the user shows.
#         """
#         selected = list(self.object.cohorts.all())
#         cohorts = EditableFilter.objects.filter(tags='cohort')
#         for cohort in cohorts:
#             if cohort in selected:
#                 cohort.is_selected = True
#         return cohorts
# 
#     def get_context_data(self, **kwargs):
#         context = super(MatrixDetailView, self).get_context_data(**kwargs)
#         metrics = EditableFilter.objects.filter(tags='metric')
#         for metric in metrics:
#             if metric == self.object.metric:
#                 metric.is_selected = True
#         url_kwargs = {'editable_filter': ''}
#         url_kwargs.update(self.get_url_kwargs())
#         context.update({
#             'cohorts': self.get_cohorts(),
#             'metrics': metrics,
#             'editable_filter_api_base': reverse('editable_filter_api',
#                 kwargs=url_kwargs),
#         })
#         url_kwargs = {self.matrix_url_kwarg: str(self.object)}
#         url_kwargs.update(self.get_url_kwargs())
#         context.update({
#             'matrix_api': reverse('matrix_api', kwargs=url_kwargs),
#         })
#         return context
# 
#     def get_object(self, queryset=None):
#         if queryset is None:
#             queryset = self.get_queryset()
#         return get_object_or_404(
#             queryset, slug=self.kwargs.get(self.matrix_url_kwarg))
# 
#     def get_template_names(self):
#         names = super(MatrixDetailView, self).get_template_names()
#         names.insert(0, "survey/matrix/%s.html" % self.object.slug)
#         return names
# 
# class AccountListView(EditableFilterView):
# 
#     api_url = 'survey_api_accounts_filter'
# 
# class QuestionListView(EditableFilterView):
# 
#     api_url = 'survey_api_questions_filter'


# Path: survey/urls/matrix.py
from django.conf.urls import url
from ..settings import SLUG_RE
from ..views.matrix import (MatrixListView, MatrixDetailView,
    AccountListView, QuestionListView)

# 1. Redistributions of source code must retain the above copyright notice,
#    this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.




urlpatterns = [
   url(r'^accounts/(?P<editable_filter>%s)/?' % SLUG_RE,
       AccountListView.as_view(), name='accounts_list'),
   url(r'^accounts/',
       AccountListView.as_view(), name='accounts_base'),
   url(r'^questions/(?P<editable_filter>%s)/?' % SLUG_RE,
       QuestionListView.as_view(), name='questions_list'),
   url(r'^questions/',
       QuestionListView.as_view(), name='questions_base'),

   url(r'^(?P<path>%s)/' % SLUG_RE,