# Path: moth/views/base/form_template_view.py
# class FormTemplateView(VulnerableTemplateView):
#     template_name = "moth/vulnerability-form.html"
#     form_klass = GenericForm
#     
#     def get(self, request, *args, **kwargs):
#         form = self.form_klass()
#         return render(request, self.template_name,
#                       self.get_context_data(form=form))


from django.shortcuts import render
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Field, Submit
from moth.views.base.form_template_view import FormTemplateView




class UploadForm(forms.Form):
    _file = forms.FileField()

    def __init__(self, * args, **kwargs):
        # pylint: disable=E1002
        super(UploadForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_id = 'upload'
        self.helper.form_action = 'upload.py'
        self.helper.form_method = 'post'
        self.helper.form_class = 'form-horizontal'
        
        submit = Submit('Upload', 'Upload', css_class="btn-success")

        # generate layout
        self.helper.layout = Layout(
                                    Field('_file'),
                                    submit

# Path: moth/views/base/form_template_view.py
# class FormTemplateView(VulnerableTemplateView):
#     template_name = "moth/vulnerability-form.html"
#     form_klass = GenericForm
#     
#     def get(self, request, *args, **kwargs):
#         form = self.form_klass()
#         return render(request, self.template_name,
#                       self.get_context_data(form=form))


# Path: moth/views/vulnerabilities/core/file_upload.py
from django.shortcuts import render
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Field, Submit
from moth.views.base.form_template_view import FormTemplateView





class UploadForm(forms.Form):
    _file = forms.FileField()

    def __init__(self, * args, **kwargs):
        # pylint: disable=E1002
        super(UploadForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_id = 'upload'
        self.helper.form_action = 'upload.py'
        self.helper.form_method = 'post'
        self.helper.form_class = 'form-horizontal'
        
        submit = Submit('Upload', 'Upload', css_class="btn-success")

        # generate layout
        self.helper.layout = Layout(
                                    Field('_file'),
                                    submit

        )