Exemple #1
0
class CollectionAdminView(OpacBaseAdminView):
    can_edit = True
    edit_modal = True
    form_excluded_columns = ('acronym', 'metrics')
    column_exclude_list = [
        '_id', 'about', 'home_logo_pt', 'home_logo_es', 'home_logo_en',
        'header_logo_pt', 'header_logo_es', 'header_logo_en', 'menu_logo_pt',
        'menu_logo_es', 'menu_logo_en', 'logo_footer', 'logo_drop_menu'
    ]
    column_labels = dict(
        name=__('Nome'),
        about=__('Acerca de'),
        acronym=__('Acrônimo'),
        address1=__('Endereço principal'),
        address2=__('Endereço secundário'),
        home_logo_pt=__('Logo da Home (PT)'),
        home_logo_en=__('Logo da Home (EN)'),
        home_logo_es=__('Logo da Home (ES)'),
        header_logo_pt=__('Logo do cabeçalho (PT)'),
        header_logo_en=__('Logo do cabeçalho (EN)'),
        header_logo_es=__('Logo do cabeçalho (ES)'),
        menu_logo_pt=__('Logo do menu (PT)'),
        menu_logo_en=__('Logo do menu (ES)'),
        menu_logo_es=__('Logo do menu (ES)'),
        logo_drop_menu=__('Logo do menu (drop)'),
        logo_footer=__('Logo do rodapé'),
    )

    inline_models = (InlineFormAdmin(Sponsor), )
Exemple #2
0
    def get_info(self, p):
        info = super(InlineModelConverter, self).get_info(p)

        if info is None:
            if isinstance(p, BaseModel):
                info = InlineFormAdmin(p)
            else:
                model = getattr(p, 'model', None)
                if model is None:
                    raise Exception('Unknown inline model admin: %s' % repr(p))

                attrs = dict()

                for attr in dir(p):
                    if not attr.startswith('_') and attr != 'model':
                        attrs[attr] = getattr(p, attr)

                info = InlineFormAdmin(model, **attrs)

        # Resolve AJAX FKs
        info._form_ajax_refs = self.process_ajax_refs(info)

        return info
Exemple #3
0
    def get_info(self, p):
        info = super(InlineModelConverter, self).get_info(p)

        if info is None:
            if isinstance(p, BaseModel):
                info = InlineFormAdmin(p)
            else:
                model = getattr(p, 'model', None)
                if model is None:
                    raise Exception('Unknown inline model admin: %s' % repr(p))

                attrs = dict()

                for attr in dir(p):
                    if not attr.startswith('_') and attr != 'model':
                        attrs[attr] = getattr(p, attr)

                info = InlineFormAdmin(model, **attrs)

        # Resolve AJAX FKs
        info._form_ajax_refs = self.process_ajax_refs(info)

        return info