Skip to content

Admin

hypha.apply.categories.admin

CategoryAdmin

Bases: ModelAdmin

menu_label class-attribute instance-attribute

menu_label = 'Category Questions'

menu_icon class-attribute instance-attribute

menu_icon = str(CATEGORY)

model class-attribute instance-attribute

model = Category

MetaTermAdmin

Bases: ModelAdmin

model class-attribute instance-attribute

model = MetaTerm

menu_icon class-attribute instance-attribute

menu_icon = str(META_TERM)

list_per_page class-attribute instance-attribute

list_per_page = 50

list_display class-attribute instance-attribute

list_display = ('get_as_listing_header', 'get_parent')

search_fields class-attribute instance-attribute

search_fields = ('name')

inspect_view_enabled class-attribute instance-attribute

inspect_view_enabled = True

inspect_view_fields class-attribute instance-attribute

inspect_view_fields = ('name', 'get_parent', 'id')

button_helper_class class-attribute instance-attribute

button_helper_class = MetaTermButtonHelper

add_child_view

add_child_view(request, instance_pk)
Source code in hypha/apply/categories/admin.py
def add_child_view(self, request, instance_pk):
    kwargs = {"model_admin": self, "parent_pk": instance_pk}
    view_class = AddChildMetaTermViewClass
    return view_class.as_view(**kwargs)(request)

get_admin_urls_for_registration

get_admin_urls_for_registration()

Add the new url for add child page to the registered URLs.

Source code in hypha/apply/categories/admin.py
def get_admin_urls_for_registration(self):
    """Add the new url for add child page to the registered URLs."""
    urls = super().get_admin_urls_for_registration()
    add_child_url = re_path(
        self.url_helper.get_action_url_pattern("add_child"),
        self.add_child_view,
        name=self.url_helper.get_action_url_name("add_child"),
    )
    return urls + (add_child_url,)