# Path: core/consts.py
# IN_PROGRESS = 'in_progress'
# COMPLETED = 'completed'
# STOPPED = 'stopped'
# FAIL = 'fail'
# WAIT = 'wait'
# STATUSES = [IN_PROGRESS, COMPLETED, STOPPED, FAIL, WAIT]
# STATUS_CHOICES = [(status, status) for status in STATUSES]
# NOT_RUN_STATUSES = [COMPLETED, STOPPED, FAIL]
# RUN_STATUSES = [IN_PROGRESS, WAIT]
# VERBOSE_CHOICES = (
#     ('', 'silent'),
#     ('v', 'standard'),
#     ('vv', 'detail'),
#     ('vvv', 'very detail'),
#     ('vvvv', 'all'),
# )
# 
# Path: core/models.py
# def create_auth_token(sender, instance=None, created=False, **kwargs):
# def validate_cron(value):
#     def __init__(self, *args, **kwargs):
#     def formfield(self, **kwargs):
#     def validate(self, value, model_instance):
#     def get_actual_hosts(self) -> models.QuerySet:
#     def get_playbook_name(self) -> str:
#     def get_hosts_without_groups(self) -> models.QuerySet:
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def get_vars(self):
#     def __str__(self):
#     def __str__(self):
#     def create_task(self, user, is_automatically_created=False, repeat_number=0):
#     def have_uncompleted_task(self):
#     def __str__(self):
#     def get_ansible_command(self):
#     def get_duration(self) -> datetime.timedelta:
#     def stop(self):
#     def __str__(self):
# class CronField(models.CharField):
# class TaskOperationsMixin:
# class Variable(models.Model):
#     class Meta:
# class HostGroup(models.Model):
#     class Meta:
# class Host(models.Model):
#     class Meta:
# class AnsibleUser(models.Model):
#     class Meta:
# class TaskTemplate(TaskOperationsMixin, models.Model):
#     class Meta:
# class RepeatSetting(models.Model):
# class Task(TaskOperationsMixin, models.Model):
#     class Meta:
# class TaskLog(models.Model):
#     class Meta:
# 
# Path: core/datatools/ansible.py
# def make_command(task) -> str:
# def create_inventory(task) -> str:
# def get_inventory_file_path(ansible_shell_command: str):
# 
# Path: core/generic/mixins.py
# class BreadcrumbsMixin(ContextMixin):
# class PermissionRequiredMixin(PermissionRequiredMixinAuth):
# class FormMixin(DjangoFormMixin):
# class FormAndFormsetMixin(FormMixin):
# class FormAndModelFormsetMixin(FormAndFormsetMixin):
# class NextMixin(ContextMixin):
#     def get_breadcrumbs(self):
#     def get_context_data(self, **kwargs):
#     def handle_no_permission(self):
#     def get_form_kwargs(self):
#     def get_formset_class(self):
#     def get_formset_initial(self):
#     def get_formset_kwargs(self):
#     def get_formset(self, clean=False):
#     def post(self, request, *args, **kwargs):
#     def form_invalid(self, form, formset):
#     def get_context_data(self, *args, **kwargs):
#     def form_valid(self, form, formset):
#     def get_formset_initial(self):
#     def get_formset_class(self):
#     def get_context_data(self, **kwargs):
# 
# Path: core/generic/views.py
# class TemplateView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoTemplateView):
# class View(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoView):
# class ListView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoListView):
# class DetailView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoDetailView):
# class DeleteView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoDeleteView):
# class CreateView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoCreateView):
# class UpdateView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoUpdateView):
# class FormView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoFormView):
# class EditView(CreateView):
#     def get_object(self):
#     def get_title(self):


import os
import core.forms.task_template
from django.shortcuts import get_object_or_404
from django.http import HttpResponse
from django.db.models import Max
from django.contrib import messages
from django.shortcuts import redirect
from django.urls import reverse
from django.urls import reverse_lazy
from django.views.generic.detail import SingleObjectMixin
from django.forms import modelformset_factory
from djutils.views.generic import SortMixin
from core import consts
from core import models
from core.datatools import ansible
from core.generic import mixins
from core.generic import views

        return super().form_valid(form)

    def get_success_url(self):
        return reverse_lazy('task_template_update', kwargs={'pk': self.new_template.pk})

copy = Copy.as_view()


class Delete(mixins.PermissionRequiredMixin, views.DeleteView):
    template_name = 'core/task_template/delete.html'
    model = models.TaskTemplate
    permission_required = 'core.delete_tasktemplate'
    success_url = reverse_lazy('task_template_search')

    def get_title(self):
        obj = self.get_object()
        return "Delete %s" % obj

    def get_breadcrumbs(self):
        obj = self.get_object()
        return (
            ('Home', reverse('index')),
            (Search.title, reverse('task_template_search')),
            (str(obj), reverse('task_template_update', kwargs={'pk': obj.id})),
            ('Delete', '')
        )
delete = Delete.as_view()



# Path: core/consts.py
# IN_PROGRESS = 'in_progress'
# COMPLETED = 'completed'
# STOPPED = 'stopped'
# FAIL = 'fail'
# WAIT = 'wait'
# STATUSES = [IN_PROGRESS, COMPLETED, STOPPED, FAIL, WAIT]
# STATUS_CHOICES = [(status, status) for status in STATUSES]
# NOT_RUN_STATUSES = [COMPLETED, STOPPED, FAIL]
# RUN_STATUSES = [IN_PROGRESS, WAIT]
# VERBOSE_CHOICES = (
#     ('', 'silent'),
#     ('v', 'standard'),
#     ('vv', 'detail'),
#     ('vvv', 'very detail'),
#     ('vvvv', 'all'),
# )
# 
# Path: core/models.py
# def create_auth_token(sender, instance=None, created=False, **kwargs):
# def validate_cron(value):
#     def __init__(self, *args, **kwargs):
#     def formfield(self, **kwargs):
#     def validate(self, value, model_instance):
#     def get_actual_hosts(self) -> models.QuerySet:
#     def get_playbook_name(self) -> str:
#     def get_hosts_without_groups(self) -> models.QuerySet:
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def get_vars(self):
#     def __str__(self):
#     def __str__(self):
#     def create_task(self, user, is_automatically_created=False, repeat_number=0):
#     def have_uncompleted_task(self):
#     def __str__(self):
#     def get_ansible_command(self):
#     def get_duration(self) -> datetime.timedelta:
#     def stop(self):
#     def __str__(self):
# class CronField(models.CharField):
# class TaskOperationsMixin:
# class Variable(models.Model):
#     class Meta:
# class HostGroup(models.Model):
#     class Meta:
# class Host(models.Model):
#     class Meta:
# class AnsibleUser(models.Model):
#     class Meta:
# class TaskTemplate(TaskOperationsMixin, models.Model):
#     class Meta:
# class RepeatSetting(models.Model):
# class Task(TaskOperationsMixin, models.Model):
#     class Meta:
# class TaskLog(models.Model):
#     class Meta:
# 
# Path: core/datatools/ansible.py
# def make_command(task) -> str:
# def create_inventory(task) -> str:
# def get_inventory_file_path(ansible_shell_command: str):
# 
# Path: core/generic/mixins.py
# class BreadcrumbsMixin(ContextMixin):
# class PermissionRequiredMixin(PermissionRequiredMixinAuth):
# class FormMixin(DjangoFormMixin):
# class FormAndFormsetMixin(FormMixin):
# class FormAndModelFormsetMixin(FormAndFormsetMixin):
# class NextMixin(ContextMixin):
#     def get_breadcrumbs(self):
#     def get_context_data(self, **kwargs):
#     def handle_no_permission(self):
#     def get_form_kwargs(self):
#     def get_formset_class(self):
#     def get_formset_initial(self):
#     def get_formset_kwargs(self):
#     def get_formset(self, clean=False):
#     def post(self, request, *args, **kwargs):
#     def form_invalid(self, form, formset):
#     def get_context_data(self, *args, **kwargs):
#     def form_valid(self, form, formset):
#     def get_formset_initial(self):
#     def get_formset_class(self):
#     def get_context_data(self, **kwargs):
# 
# Path: core/generic/views.py
# class TemplateView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoTemplateView):
# class View(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoView):
# class ListView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoListView):
# class DetailView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoDetailView):
# class DeleteView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoDeleteView):
# class CreateView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoCreateView):
# class UpdateView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoUpdateView):
# class FormView(mixins.BreadcrumbsMixin, mixins.NextMixin, TitleMixin, DjangoFormView):
# class EditView(CreateView):
#     def get_object(self):
#     def get_title(self):


# Path: core/views/task_template.py
import os
import core.forms.task_template
from django.shortcuts import get_object_or_404
from django.http import HttpResponse
from django.db.models import Max
from django.contrib import messages
from django.shortcuts import redirect
from django.urls import reverse
from django.urls import reverse_lazy
from django.views.generic.detail import SingleObjectMixin
from django.forms import modelformset_factory
from djutils.views.generic import SortMixin
from core import consts
from core import models
from core.datatools import ansible
from core.generic import mixins
from core.generic import views


        return super().form_valid(form)

    def get_success_url(self):
        return reverse_lazy('task_template_update', kwargs={'pk': self.new_template.pk})

copy = Copy.as_view()


class Delete(mixins.PermissionRequiredMixin, views.DeleteView):
    template_name = 'core/task_template/delete.html'
    model = models.TaskTemplate
    permission_required = 'core.delete_tasktemplate'
    success_url = reverse_lazy('task_template_search')

    def get_title(self):
        obj = self.get_object()
        return "Delete %s" % obj

    def get_breadcrumbs(self):
        obj = self.get_object()
        return (
            ('Home', reverse('index')),
            (Search.title, reverse('task_template_search')),
            (str(obj), reverse('task_template_update', kwargs={'pk': obj.id})),
            ('Delete', '')
        )
delete = Delete.as_view()



class Run(mixins.PermissionRequiredMixin, SingleObjectMixin, views.View):