# Path: helper/views.py
# class AgentConfigDetailView(UpdateView):
#     model = AgentConfig
#     template_name_suffix = '_detail'
#     form_class = AgentConfigUpdateForm
# 
#     def get_success_url(self):
#         return self.object.get_absolute_url()
# 
# class AgentConfigListView(ListView):
#     model = AgentConfig
# 
# class AgentConfigDeleteView(DeleteView):
#     model = AgentConfig
#     success_url = reverse_lazy('agent_config_list')
# 
#     def get_context_data(self, **kwargs):
#         context = super(AgentConfigDeleteView, self).get_context_data(**kwargs)
#         context['cascade_task_pairs'] = TaskPair.objects.filter(
#             Q(cause_agent=self.object) | Q(effect_agent=self.object)
#         ).distinct()
#         return context
# 
# class AgentConfigCreateView(CreateView):
#     model = AgentConfig
#     form_class = AgentConfigCreateForm
# 
# class TaskPairDetailView(UpdateView):
#     model = TaskPair
#     template_name_suffix = '_detail'
#     form_class = TaskPairUpdateForm
# 
#     def get_success_url(object):
#         return reverse('task_pair_list')
# 
# class TaskPairListView(ListView):
#     model = TaskPair
# 
# class TaskPairDeleteView(DeleteView):
#     model = TaskPair
#     success_url = reverse_lazy('task_pair_list')
# 
# class TaskPairWizard(SessionWizardView):
#     form_list = [TaskPairChooseCauseAgentForm, TaskPairChooseCauseTaskForm,
#                  TaskPairCauseOptionsForm,
#                  TaskPairChooseEffectAgentForm, TaskPairChooseEffectTaskForm,
#                  TaskPairEffectOptionsForm,
#                  ]
#     template_name = 'helper/taskpair_wizard.html'
# 
# 
#     def render_done(self, form, **kwargs):
#         """
#         Dont' want all the revalidation storage stuff... The form is fine :)
#         """
#         task_pair = TaskPair.objects.create(**form.cleaned_data)
#         task_pair.populate_dedup_events()
#         return redirect(task_pair)
# 
#     def process_step(self, form):
#         """
#         user cleaned_data as next forms initial data
#         """
#         if self.steps.next:
#             self.initial_dict.setdefault(self.steps.next, {}).update({
#                 k: v.pk if hasattr(v, 'pk') else v
#                 for k, v in form.cleaned_data.items()})
# 
# class TaskPairAdvancedDetailView(UpdateView):
#     model = TaskPair
#     template_name_suffix = '_detail'
#     form_class = TaskPairAdvancedForm
# 
#     def get_success_url(object):
#         return reverse('task_pair_list')
# 
# class TaskPairCreateView(CreateView):
#     model = TaskPair
#     form_class = TaskPairAdvancedForm
#     template_name = 'helper/taskpair_detail.html'


from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import RedirectView
from .views import (AgentConfigDetailView, AgentConfigListView,
                    AgentConfigDeleteView, AgentConfigCreateView,
                    TaskPairDetailView, TaskPairListView,
                    TaskPairDeleteView, TaskPairWizard,
                    TaskPairAdvancedDetailView, TaskPairCreateView)
    # redirect to tasks for now
    url(r'^$', RedirectView.as_view(pattern_name='task_pair_list',
                                    permanent=False), name='home'),

    # agentconfig generics
    url(r'^agent/?$',
        AgentConfigListView.as_view(),
        name='agent_config_list'),
    url(r'^agent/add/?$',
        AgentConfigCreateView.as_view(),
        name='agent_config_create'),
    url(r'^agent/(?P<pk>[a-zA-Z.]+)/?$',
        AgentConfigDetailView.as_view(),
        name='agent_config_detail'),
    url(r'^agent/(?P<pk>[a-zA-Z.]+)/delete/?$',
        AgentConfigDeleteView.as_view(),
        name='agent_config_delete'),
    # agentconfig custom view
    url(r'^agent/(?P<agent_config_id>[a-zA-Z.]+)/(?P<view_name>\w+)',
        'helper.views.dispatch_agent_config_url',
        name='dispatch_agent_config_url'),

    # taskpair generics
    url(r'^task/?$',
        TaskPairListView.as_view(),
        name='task_pair_list'),
    url(r'^task/add/?$',
        TaskPairWizard.as_view(),
        name='task_pair_create'),
    url(r'^task/add/advanced/?$',

# Path: helper/views.py
# class AgentConfigDetailView(UpdateView):
#     model = AgentConfig
#     template_name_suffix = '_detail'
#     form_class = AgentConfigUpdateForm
# 
#     def get_success_url(self):
#         return self.object.get_absolute_url()
# 
# class AgentConfigListView(ListView):
#     model = AgentConfig
# 
# class AgentConfigDeleteView(DeleteView):
#     model = AgentConfig
#     success_url = reverse_lazy('agent_config_list')
# 
#     def get_context_data(self, **kwargs):
#         context = super(AgentConfigDeleteView, self).get_context_data(**kwargs)
#         context['cascade_task_pairs'] = TaskPair.objects.filter(
#             Q(cause_agent=self.object) | Q(effect_agent=self.object)
#         ).distinct()
#         return context
# 
# class AgentConfigCreateView(CreateView):
#     model = AgentConfig
#     form_class = AgentConfigCreateForm
# 
# class TaskPairDetailView(UpdateView):
#     model = TaskPair
#     template_name_suffix = '_detail'
#     form_class = TaskPairUpdateForm
# 
#     def get_success_url(object):
#         return reverse('task_pair_list')
# 
# class TaskPairListView(ListView):
#     model = TaskPair
# 
# class TaskPairDeleteView(DeleteView):
#     model = TaskPair
#     success_url = reverse_lazy('task_pair_list')
# 
# class TaskPairWizard(SessionWizardView):
#     form_list = [TaskPairChooseCauseAgentForm, TaskPairChooseCauseTaskForm,
#                  TaskPairCauseOptionsForm,
#                  TaskPairChooseEffectAgentForm, TaskPairChooseEffectTaskForm,
#                  TaskPairEffectOptionsForm,
#                  ]
#     template_name = 'helper/taskpair_wizard.html'
# 
# 
#     def render_done(self, form, **kwargs):
#         """
#         Dont' want all the revalidation storage stuff... The form is fine :)
#         """
#         task_pair = TaskPair.objects.create(**form.cleaned_data)
#         task_pair.populate_dedup_events()
#         return redirect(task_pair)
# 
#     def process_step(self, form):
#         """
#         user cleaned_data as next forms initial data
#         """
#         if self.steps.next:
#             self.initial_dict.setdefault(self.steps.next, {}).update({
#                 k: v.pk if hasattr(v, 'pk') else v
#                 for k, v in form.cleaned_data.items()})
# 
# class TaskPairAdvancedDetailView(UpdateView):
#     model = TaskPair
#     template_name_suffix = '_detail'
#     form_class = TaskPairAdvancedForm
# 
#     def get_success_url(object):
#         return reverse('task_pair_list')
# 
# class TaskPairCreateView(CreateView):
#     model = TaskPair
#     form_class = TaskPairAdvancedForm
#     template_name = 'helper/taskpair_detail.html'


# Path: helper/urls.py
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import RedirectView
from .views import (AgentConfigDetailView, AgentConfigListView,
                    AgentConfigDeleteView, AgentConfigCreateView,
                    TaskPairDetailView, TaskPairListView,
                    TaskPairDeleteView, TaskPairWizard,
                    TaskPairAdvancedDetailView, TaskPairCreateView)

    # redirect to tasks for now
    url(r'^$', RedirectView.as_view(pattern_name='task_pair_list',
                                    permanent=False), name='home'),

    # agentconfig generics
    url(r'^agent/?$',
        AgentConfigListView.as_view(),
        name='agent_config_list'),
    url(r'^agent/add/?$',
        AgentConfigCreateView.as_view(),
        name='agent_config_create'),
    url(r'^agent/(?P<pk>[a-zA-Z.]+)/?$',
        AgentConfigDetailView.as_view(),
        name='agent_config_detail'),
    url(r'^agent/(?P<pk>[a-zA-Z.]+)/delete/?$',
        AgentConfigDeleteView.as_view(),
        name='agent_config_delete'),
    # agentconfig custom view
    url(r'^agent/(?P<agent_config_id>[a-zA-Z.]+)/(?P<view_name>\w+)',
        'helper.views.dispatch_agent_config_url',
        name='dispatch_agent_config_url'),

    # taskpair generics
    url(r'^task/?$',
        TaskPairListView.as_view(),
        name='task_pair_list'),
    url(r'^task/add/?$',
        TaskPairWizard.as_view(),
        name='task_pair_create'),
    url(r'^task/add/advanced/?$',

        TaskPairCreateView.as_view(),