2016-04-10 21:12:43 +00:00
|
|
|
from django.contrib import messages
|
|
|
|
|
|
|
|
from django.views.generic.edit import FormView
|
2016-04-12 05:50:15 +00:00
|
|
|
from django.utils.translation import ugettext_lazy as _
|
2017-06-29 14:34:40 +00:00
|
|
|
from django.core.urlresolvers import reverse_lazy
|
2016-04-16 01:18:29 +00:00
|
|
|
from django.views.generic import View
|
2017-06-29 14:34:40 +00:00
|
|
|
from django.shortcuts import render
|
2016-04-16 01:18:29 +00:00
|
|
|
|
2016-04-10 21:12:43 +00:00
|
|
|
from utils.forms import ContactUsForm
|
|
|
|
|
|
|
|
|
2016-04-16 01:18:29 +00:00
|
|
|
class LandingView(View):
|
2016-04-13 03:03:18 +00:00
|
|
|
template_name = "ungleich_page/landing.html"
|
2016-04-16 01:18:29 +00:00
|
|
|
form_class = ContactUsForm
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
|
form = self.form_class()
|
|
|
|
return render(request, self.template_name, {'form': form})
|
2016-04-13 03:03:18 +00:00
|
|
|
|
|
|
|
|
2016-04-10 21:12:43 +00:00
|
|
|
class ContactView(FormView):
|
2016-04-16 01:18:29 +00:00
|
|
|
template_name = 'ungleich_page/landing.html'
|
2016-04-10 21:12:43 +00:00
|
|
|
form_class = ContactUsForm
|
2016-04-16 01:18:29 +00:00
|
|
|
success_url = reverse_lazy('ungleich_page:landing')
|
2016-04-10 21:12:43 +00:00
|
|
|
success_message = _('Message Successfully Sent')
|
|
|
|
|
|
|
|
def form_valid(self, form):
|
2023-11-17 02:29:10 +00:00
|
|
|
#form.save()
|
|
|
|
#form.send_email()
|
|
|
|
#messages.add_message(self.request, messages.SUCCESS, self.success_message)
|
2016-04-10 21:12:43 +00:00
|
|
|
return super(ContactView, self).form_valid(form)
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs):
|
|
|
|
context = super(ContactView, self).get_context_data(**kwargs)
|
|
|
|
context['page_title'] = _('Contact Us')
|
|
|
|
context['page_subtitle'] = _('If you have any question, just send us an email.')
|
|
|
|
return context
|