# Path: splunk_wftoolkit/django/splunk_wftoolkit/forms.py
# class SetupForm(forms.Form):
#     email = forms.EmailField(
#         endpoint='configs/conf-setup', entity='auth', field='email',     # (2)
#         max_length=100)
#     password = forms.CharField(
#         endpoint='configs/conf-setup', entity='auth', field='password',  # (2)
#         max_length=100,
#         widget=forms.PasswordInput(render_value=True))


from django.contrib.auth.decorators import login_required
from splunkdj.decorators.render import render_to
from .forms import SetupForm
from django.core.urlresolvers import reverse
from splunkdj.setup import config_required
from splunkdj.setup import create_setup_view_context

# Imports for the setup view

@render_to('splunk_wftoolkit:home.html')
@login_required
#@config_required   # enable when using a real setup view
def home(request):
    return {
        # No special variables
    }

@render_to()
@login_required
#@config_required   # enable when using a real setup view
def render_page(request, tmpl):
    return {
        "TEMPLATE": "splunk_wftoolkit:%s.html" % tmpl
    }

@render_to('splunk_wftoolkit:setup.html')
@login_required
def setup(request):
    # Renders the setup view, passing the following variables to the template:
    #   * form -- Can be rendered with {{ form.as_p }}.
    #   * configured -- Whether the app has already been configured.
    #                   If false, then the existing configuration is being edited.
    return create_setup_view_context(
        request,

# Path: splunk_wftoolkit/django/splunk_wftoolkit/forms.py
# class SetupForm(forms.Form):
#     email = forms.EmailField(
#         endpoint='configs/conf-setup', entity='auth', field='email',     # (2)
#         max_length=100)
#     password = forms.CharField(
#         endpoint='configs/conf-setup', entity='auth', field='password',  # (2)
#         max_length=100,
#         widget=forms.PasswordInput(render_value=True))


# Path: splunk_wftoolkit/django/splunk_wftoolkit/views.py
from django.contrib.auth.decorators import login_required
from splunkdj.decorators.render import render_to
from .forms import SetupForm
from django.core.urlresolvers import reverse
from splunkdj.setup import config_required
from splunkdj.setup import create_setup_view_context


# Imports for the setup view

@render_to('splunk_wftoolkit:home.html')
@login_required
#@config_required   # enable when using a real setup view
def home(request):
    return {
        # No special variables
    }

@render_to()
@login_required
#@config_required   # enable when using a real setup view
def render_page(request, tmpl):
    return {
        "TEMPLATE": "splunk_wftoolkit:%s.html" % tmpl
    }

@render_to('splunk_wftoolkit:setup.html')
@login_required
def setup(request):
    # Renders the setup view, passing the following variables to the template:
    #   * form -- Can be rendered with {{ form.as_p }}.
    #   * configured -- Whether the app has already been configured.
    #                   If false, then the existing configuration is being edited.
    return create_setup_view_context(
        request,

        SetupForm,                  # the form class to use