예제 #1
0
 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)
예제 #2
0
    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)
예제 #3
0
 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
예제 #4
0
    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
예제 #5
0
    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
예제 #7
0
    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
예제 #8
0
 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