Пример #1
0
    def get_context_data(self, **kwargs):
        context = {}
        context['title'] = _('Select a contact group')
        context['objtype'] = ContactGroup
        context['nav'] = Navbar(ContactGroup.get_class_navcomponent())

        context.update(kwargs)
        return super().get_context_data(**context)
Пример #2
0
    def get_context_data(self, **kwargs):
        context = {}
        if self.object:
            title = _('Editing {}').format(self.object)
            id = self.object.id
        else:
            title = (_('Adding a new {}')
                     .format(ContactGroup.get_class_verbose_name()))
            id = None

        context['title'] = title
        context['id'] = id
        context['objtype'] = ContactGroup

        if id:
            context['nav'] = self.object.get_smart_navbar()
            context['nav'].add_component(('edit', _('edit')))
        else:
            context['nav'] = Navbar(ContactGroup.get_class_navcomponent())
            context['nav'].add_component(('add', _('add')))

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