# Path: brasilcomvc/feedback/forms.py
# class FeedbackForm(forms.ModelForm):
# 
#     class Meta:
#         fields = [
#             'email',
#             'question_1',
#             'question_2',
#             'question_3',
#             'question_4',
#             'question_5',
#             'comments',
#         ]
#         model = Feedback
# 
#     def __init__(self, *args, **kwargs):
#         super(FeedbackForm, self).__init__(*args, **kwargs)
#         self.fields['email'].widget = forms.HiddenInput()
#         self.fields['comments'].required = False


from django.contrib import messages
from django.views.generic import CreateView
from .forms import FeedbackForm



class Create(CreateView):

    form_class = FeedbackForm
    template_name = 'feedback/create.html'

    def get_success_url(self):
        return self.request.GET['next']

    def form_valid(self, form):
        message = self.request.session.pop('feedback_success_message', None)
        if message:
            messages.success(self.request, message)

        self.request.session.pop('deleted_email')
        return super(Create, self).form_valid(form)


# Path: brasilcomvc/feedback/forms.py
# class FeedbackForm(forms.ModelForm):
# 
#     class Meta:
#         fields = [
#             'email',
#             'question_1',
#             'question_2',
#             'question_3',
#             'question_4',
#             'question_5',
#             'comments',
#         ]
#         model = Feedback
# 
#     def __init__(self, *args, **kwargs):
#         super(FeedbackForm, self).__init__(*args, **kwargs)
#         self.fields['email'].widget = forms.HiddenInput()
#         self.fields['comments'].required = False


# Path: brasilcomvc/feedback/views.py
from django.contrib import messages
from django.views.generic import CreateView
from .forms import FeedbackForm




class Create(CreateView):

    form_class = FeedbackForm
    template_name = 'feedback/create.html'

    def get_success_url(self):
        return self.request.GET['next']

    def form_valid(self, form):
        message = self.request.session.pop('feedback_success_message', None)
        if message:
            messages.success(self.request, message)

        self.request.session.pop('deleted_email')
        return super(Create, self).form_valid(form)


    def get_form_kwargs(self):