import json from django.views.generic import TemplateView from django.shortcuts import HttpResponse #from forms import CallbackForm from service.order_forms import CallBackForm from meta.views import MetadataMixin from functions.cache_mixin import JitterCacheMixin from settings.models import LandingComment class AdvertisingView(MetadataMixin, TemplateView): template_name = 'simple_pages/advertising.html' class AdvertisingViewLanding(JitterCacheMixin, AdvertisingView): template_name = 'simple_pages/advertising_landing.html' def get_context_data(self, **kwargs): context = super(AdvertisingViewLanding, self).get_context_data(**kwargs) context['comments'] = LandingComment.objects.language().all() return context class AboutView(MetadataMixin, TemplateView): template_name = 'simple_pages/about.html' def callback(request): response = {'success': False} if request.GET: form = CallBackForm(request.GET) if form.is_valid(): form.save() response['success'] = True else: response['errors'] = form.errors return HttpResponse(json.dumps(response), content_type='application/json')