コード例 #1
0
    def get_context_data(self, **kwargs):
        context = super(Usages, self).get_context_data(**kwargs)

        if self.usage_type:
            by_warehouse = self.usage_type.by_warehouse
            by_internet_provider = self.usage_type.by_internet_provider
        else:
            by_warehouse = None
            by_internet_provider = None

        by_cost = self.usage_type.by_cost if self.usage_type else None
        by_team = self.usage_type.by_team if self.usage_type else None
        context.update({
            'section': 'usages',
            'sidebar_items': usages_menu(
                '/{0}/usages'.format(Scrooge.url_prefix),
                self.usage_type_name
            ),
            'sidebar_selected': self.usage_type_name,
            'by_cost': by_cost,
            'by_warehouse': by_warehouse,
            'by_team': by_team,
            'by_internet_provider': by_internet_provider,
            'formset': self.formset,
            'hidden': {
                'by_cost': ['price', 'forecast_price'],
                'not_by_cost': ['cost', 'forecast_cost'],
                'not_by_warehouse': ['warehouse'],
                'not_by_team': ['team', 'team_members_count'],
                'not_by_internet_provider': ['internet_provider'],
            }
        })
        return context
コード例 #2
0
 def get_context_data(self, **kwargs):
     context = super(Usages, self).get_context_data(**kwargs)
     context.update({
         'section': 'usages',
         'sidebar_items': usages_menu(
             '/pricing/usages',
             self.usage_type_name
         ),
         'sidebar_selected': self.usage_type_name,
         'formset': self.formset,
     })
     return context
コード例 #3
0
 def get_context_data(self, **kwargs):
     context = super(Usages, self).get_context_data(**kwargs)
     context.update({
         'section':
         'usages',
         'sidebar_items':
         usages_menu('/pricing/usages', self.usage_type_name),
         'sidebar_selected':
         self.usage_type_name,
         'formset':
         self.formset,
     })
     return context