Ejemplo n.º 1
0
    def get_context_data(self, **kwargs):
        context = {}
        cg = self.contactgroup
        if self.object:
            title = _('Editing choices for {}').format(self.field)
            id = self.object.id
        else:
            title = _('Adding a new {}').format(
                ChoiceGroup.get_class_verbose_name())
            id = None
        context['title'] = title
        context['id'] = id
        context['objtype'] = ChoiceGroup
        context['nav'] = cg.get_smart_navbar()
        context['nav'].add_component(('fields', _('contact fields')))
        if id:
            context['nav'].add_component(self.object.get_navcomponent())
            context['nav'].add_component(('choices', _('choices')))
        else:
            context['nav'].add_component(('add', _('add')))  # obsolete
        context['active_submenu'] = 'fields'

        context.update(kwargs)
        return super().get_context_data(**context)