Returns the context data to provide to the template.
353180
def get_context_data(self, **kwargs):
        
        context = super().get_context_data(**kwargs)

        # Handles the preview of the poll
        if context['poll_option_formset']:
            if hasattr(self, 'poll_preview') and self.poll_preview:
                context['poll_preview'] = self.poll_preview
                context['poll_options_previews'] = filter(
                    lambda f: f['text'].value() and not f['DELETE'].value(),
                    context['poll_option_formset'].forms,
                )

        return context
858457
def get_context_data(self, **kwargs):
        
        context = super().get_context_data(**kwargs)

        # Insert the considered topic and the associated forum into the context
        topic = self.get_topic()
        context['topic'] = topic
        context['forum'] = topic.forum

        # Handles the case when a poll is associated to the topic
        try:
            if hasattr(topic, 'poll') and topic.poll.options.exists():
                context['poll'] = topic.poll
                context['poll_form'] = self.poll_form_class(poll=topic.poll)
                context['view_results_action'] = self.request.GET.get('view_results', None)
                context['change_vote_action'] = self.request.GET.get('change_vote', None)
        except ObjectDoesNotExist:  # pragma: no cover
            pass

        return context
1092280
def get_context_data(self, **kwargs):
        '''
        
        '''
        context = super(PageList, self).get_context_data(**kwargs)
        page_base_template = "nupages/base.html"
        # if MultiTenantMiddleware is used, use a base template specific to 
        # the tenants SITE_ID
        if hasattr(self.request, 'site_id'):
            page_base_template = select_template(
                ["nupages/tenants/{}/base.html".format(self.request.site_id), 
                page_base_template])
        context['base_template'] = page_base_template
        print page_base_template
        return context
650349
def get_context_data(self, **kwargs):
        
        #noinspection PyUnresolvedReferences
        query_str           = self.request.GET.get('q', None)
        queryset            = kwargs.pop('object_list', self.object_list)
        context_object_name = self.get_context_object_name(queryset)

        # Build the context dictionary.
        context = {
            'ordering':     self.get_ordering(),
            'query_string': query_str,
            'is_searching': bool(query_str),
        }

        # Add extra variables to context for non-AJAX requests.
        #noinspection PyUnresolvedReferences
        if not self.request.is_ajax() or kwargs.get('force_search', False):
            context.update({
                'search_form':  self.get_search_form(),
                'popular_tags': self.model.popular_tags()
            })

        if context_object_name is not None:
            context[context_object_name] = queryset

        # Update context with any additional keyword arguments.
        context.update(kwargs)

        return super(IndexView, self).get_context_data(**context)
850155
def get_context(self):
        
        if not self.is_valid():
            raise ValueError("Cannot generate Context when form is invalid.")
        return dict(request=self.request, **self.cleaned_data)
193790
def context(self, name):
        
        data = self._context(name)
        context = data.get("context")
        if context:
            return context

        assert self.load_path
        context_path = os.path.join(self.load_path, "contexts", "%s.rxt" % name)
        context = ResolvedContext.load(context_path)
        data["context"] = context
        data["loaded"] = True
        return context
648089
def get_context_data(self, **kwargs):
        """"""
        context = super(TabView, self).get_context_data(**kwargs)
        try:
            tab_group = self.get_tabs(self.request, **kwargs)
            context["tab_group"] = tab_group
            # Make sure our data is pre-loaded to capture errors.
            context["tab_group"].load_tab_data()
        except Exception:
            exceptions.handle(self.request)
        return context
42968
def get_render_data(self, **kwargs):
        
        if hasattr(self, 'get_context_data'):
            data = self.get_context_data(**kwargs)
        else:
            data = kwargs
        return data
1006232
def get_context_template():
    
    import random
    return {
        'SITE_ID': 1,
        'SECRET_KEY': ''.join(
            [random.SystemRandom().choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)]),
        'DATA_DIR': os.path.join(os.environ['PRODUCT_DIR'], '__data__'),
    }
1340186
def get_context_data(self, **kwargs):
        ''''''
        context = super(VeterinaryHome, self).get_context_data(**kwargs)
        context['medical_issues'] = MedicalIssue.objects.all()
        context['medical_conditions'] = MedicalCondition.objects.all()
        context['medical_treatments'] = MedicalTreatment.objects.all()               
        return context
39738
def get_context_data(self, **kwargs):
        
        context = super().get_context_data(**kwargs)
        topic = self.get_topic()

        # Add the previous posts to the context
        previous_posts = (
            topic.posts.filter(approved=True)
            .select_related('poster', 'updated_by')
            .prefetch_related('attachments', 'poster__forum_profile')
            .order_by('-created')
        )
        previous_posts = previous_posts[:machina_settings.TOPIC_REVIEW_POSTS_NUMBER]
        context['previous_posts'] = previous_posts

        return context
232679
def get_context_data(self, **kwargs):
        
        ctx = super(UserMediaImageViewMixin, self).get_context_data(**kwargs)
        ctx.update({
            'action': self.action,
            'next': self.next,
        })
        return ctx
1272684
public function getContext()
    {
        if (empty($this->context)) {
            return;
        }

        array_unshift($this->context, "<?php \$context = array(); \n");
        $this->context[] = "return \$context;";
        $context = implode(null, $this->context);

        // Erases context to make sure the next template context won't append to
        $this->context = null;

        return eval('?>' . $context);
    }
388007
def get_context_data(self, **kwargs):
        """"""
        data = super(MetricsListView, self).get_context_data(**kwargs)

        # Metrics organized by category, like so:
        # { <category_name>: [ <slug1>, <slug2>, ... ]}
        data.update({'metrics': get_r().metric_slugs_by_category()})
        return data
466766
def get_context_data(self, **kwargs):
        
        context = super(SmartView, self).get_context_data(**kwargs)

        # derive our field config
        self.field_config = self.derive_field_config()

        # add our fields
        self.fields = self.derive_fields()

        # build up our current parameter string, EXCLUSIVE of our page.  These
        # are used to build pagination URLs
        url_params = "?"
        order_params = ""
        for key in self.request.GET.keys():
            if key != 'page' and key != 'pjax' and (len(key) == 0 or key[0] != '_'):
                for value in self.request.GET.getlist(key):
                    url_params += "%s=%s&" % (key, urlquote(value))
            elif key == '_order':
                order_params = "&".join(["%s=%s" % (key, _) for _ in self.request.GET.getlist(key)])

        context['url_params'] = url_params
        context['order_params'] = order_params + "&"
        context['pjax'] = self.pjax

        # set our blocks
        context['blocks'] = dict()

        # stuff it all in our context
        context['fields'] = self.fields
        context['view'] = self
        context['field_config'] = self.field_config

        context['title'] = self.derive_title()

        # and any extra context the user specified
        context.update(self.extra_context)

        # by default, our base is 'base.html', but we might be pjax
        base_template = "base.html"
        if 'pjax' in self.request.GET or 'pjax' in self.request.POST:
            base_template = "smartmin/pjax.html"

        if 'HTTP_X_PJAX' in self.request.META:
            base_template = "smartmin/pjax.html"

        context['base_template'] = base_template

        # set our refresh if we have one
        refresh = self.derive_refresh()
        if refresh:
            context['refresh'] = refresh

        return context
313142
def get_context(self, name, value, attrs):
        """"""
        context = super().get_context(
            name, value, attrs)
        context['widget']['attrs']['dp_config'] = json_dumps(self.config)
        return context
336531
def get_context_data(self,**kwargs):
        '''  '''
        context = self.get_listing()
        context['showDescriptionRule'] = getConstant('registration__showDescriptionRule') or 'all'
        context.update(kwargs)

        # Update the site session data so that registration processes know to send return links to
        # the registration page.  set_return_page() is in SiteHistoryMixin.
        self.set_return_page('registration',_('Registration'))

        return super(ClassRegistrationView,self).get_context_data(**context)