def __init__(self, request, section): RequestContext.__init__(self, request) if sitenav.has_key(section): navsection = sitenav[section] else: navsection = {} self.update({'navmenu': navsection})
def __init__(self, request, dictionary=None, current_project=None, current_story=None): self.request = request if request.user.is_authenticated(): project_list = request.user.project_set.all() if project_list is None or project_list.count() == 0: raise UserHasNoProjectException else: raise UserHasNoProjectException if current_project is None: current_project = project_list[0] else: current_project = Project.objects.get(pk=current_project) if current_story is not None: try: current_story = UserStory.objects.get(id=current_story) except UserStory.DoesNotExist: current_story = None if dictionary is None: self.dictionary = { 'project_list' : project_list, 'current_project' : current_project, 'current_story': current_story, 'last_page': request.path, } else: self.dictionary = dictionary self.dictionary['project_list'] = project_list self.dictionary['current_project'] = current_project self.dictionary['current_story'] = current_story self.dictionary['last_page'] = request.path RequestContext.__init__(self, self.request, self.dictionary)
def __init__(self,*args,**kwargs): RequestContext.__init__(self,*args,**kwargs) self._marked_as_json = set() #messages from django framwork self._marked_as_json.add('messages') self['messages'] = list(self['messages']) self['json_context'] = JSONContext(self)
def __init__(self, request, view, dict=None, processors=None, current_app=None, use_l10n=None, *args, **kwargs): RequestContext.__init__(self, request, dict, current_app=current_app, use_l10n=use_l10n) if view is not None and hasattr(view, "get_view_processors"): for processor in view.get_view_processors(): p = processor() new_context = p.get_context(request, *args, **kwargs) if new_context is not None: self.update(p.get_context(request, *args, **kwargs))
def __init__(self, *args, **kwargs): RequestContext.__init__(self, *args, **kwargs) self._marked_as_json = set() #messages from django framwork self._marked_as_json.add('messages') self['messages'] = list(self['messages']) self['json_context'] = JSONContext(self)
def __init__(self, request, context, *args, **kwargs): if request.user.is_authenticated(): profile = request.user.get_profile() api_warned = warn_missing_coinbase_api(request) print "API Missing: %s" % api_warned # balance = clientlib.get_user_balance(profile) # address = clientlib.get_user_address(profile) coinexchange_account = {'profile': profile, 'coinbase_unavailable': api_warned, # 'balance': balance, # 'address': address, } print "Coinexchange account: %s" % coinexchange_account context['coinexchange_account'] = coinexchange_account else: context['coinexchange_account'] = dict() context['analytics_tag'] = settings.GOOGLE_ANALYTICS_TAG context['status_messages'] = StatusMessages(request) RequestContext.__init__(self, request, context, *args, **kwargs)
def __init__(self, request, dict=None, processors=None, current_app=None, use_l10n=None): if processors: processors.append(blog_info_processor) RequestContext.__init__(self, request, dict=dict, processors=processors, current_app=current_app, use_l10n=use_l10n) else: RequestContext.__init__(self, request, dict=dict, processors=[blog_info_processor], current_app=current_app, use_l10n=use_l10n)