def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) con = get_context_obj(self.request) context['obj'] = con['obj'] context['country'] = con['country'] context['form_class'] = self.form_class return donut_calculation(context)
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) phone = None add_device = None try: device_installment = DeviceInstallment.objects.get(plan__slug=kwargs['object'].slug) except ObjectDoesNotExist: device_installment = None except MultipleObjectsReturned: device_installment = DeviceInstallment.objects.filter(plan__slug=kwargs['object'].slug)[0] except: device_installment = None if device_installment: phone = device_installment.phone.device_phone add_device = device_installment.plan_device.all() print(add_device,"") if phone: context['pl_phone'] = phone context['pl_image'] = phone.planphoneimages.all()[0].image if add_device: context['add_device'] = add_device con = get_context_obj(self.request) context['obj'] = con['obj'] context['country'] = con['country'] return donut_calculation_plan_detail(self.get_queryset(),context)
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['form_class'] = FixedInternetForm() con = get_context_obj(self.request) context['obj'] = con['obj'] context['country'] = con['country'] return context
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) con = get_context_obj(self.request) context['form_class'] = self.form_class context['obj'] = con['obj'] context['country'] = con['country'] context['user'] = self.request.user context['next'] = self.request.META.get('HTTP_REFERER') context['categories'] = ['Mobiles'] return context
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) con = get_context_obj(self.request) context['obj'] = con['obj'] context['country'] = con['country'] context['buy_mobile'] = self.buy_mobile context['form_class'] = self.form_class print(context) return context
def process_template_response(self, request, response): if 'fixed_internet/fixed_internet_detail.html' in response.template_name: currency = " {curr}".format(curr=request.session.get('currency', 'SAR')) def replace_value(value): if ":currency" in value: return value.replace(":currency", currency) if ":data" in value: return value.replace(":data", " Kbps") return value response.context_data['objects'] = {k: replace_value(v) for (k, v) in response.context_data['object'].available_data.items()} con = get_context_obj(request) response.context_data['obj'] = con['obj'] response.context_data['country'] = con['country'] return response
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) phone = None add_device = None # phone = PlanPhone.objects.filter(deviceram__in=kwargs['object'].device_ram.all()).distinct() try: device_installment = DeviceInstallment.objects.get( plan__slug=kwargs['object'].slug) except ObjectDoesNotExist: device_installment = None except MultipleObjectsReturned: device_installment = DeviceInstallment.objects.filter( plan__slug=kwargs['object'].slug)[0] except: device_installment = None if device_installment: phone = device_installment.phone.device_phone add_device = device_installment.plan_device.all() if phone: context['pl_phone'] = phone context['pl_image'] = phone.planphoneimages.all()[0].image # add_device = PlanDevice.objects.filter(plandevice__in=[kwargs['object']]) if add_device: context['add_device'] = add_device con = get_context_obj(self.request) context['obj'] = con['obj'] context['country'] = con['country'] context['max_message_donut'] = self.request.GET.get('message', 0) context['max_data_donut'] = self.request.GET.get('data', 0) context['max_call_donut'] = self.request.GET.get('call', 0) print(context, "ccc") return context
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) con = get_context_obj(self.request) context['obj'] = con['obj'] context['country'] = con['country'] return context