djcrud_dal_topbar¶
- class djcrud_dal_topbar.views.SearchActionsColumn(verbose_name=None, accessor=None, default=None, visible=True, orderable=None, attrs=None, order_by=None, empty_values=None, localize=None, footer=None, exclude_from_export=False, linkify=False, initial_sort_descending=False)[source]¶
Bases:
Column- render(record, table)[source]¶
Return the content for a specific cell.
This method can be overridden by table.render_FOO methods on the table or by subclassing .Column.
If the value for this cell is in .empty_values, this method is skipped and an appropriate default value is rendered instead. Subclasses should set .empty_values to
()if they want to handle all values in .render.
- class djcrud_dal_topbar.views.SearchResultsTable(data=None, order_by=None, orderable=None, empty_text=None, exclude=None, attrs=None, row_attrs=None, pinned_row_attrs=None, sequence=None, prefix=None, order_by_field=None, page_field=None, per_page_field=None, template_name=None, default=None, request=None, show_header=None, show_footer=True, extra_columns=None)[source]¶
Bases:
Table
- class djcrud_dal_topbar.views.SearchView(**kwargs)[source]¶
Bases:
PaginationMixin,TemplateViewMixin,ListViewSite-wide search results page with paginated table.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- property title¶
Human-readable label with the
Viewsuffix removed.
- class djcrud_dal_topbar.views.SiteSearchView(**kwargs)[source]¶
Bases:
ViewMixin,AlightQuerySetSequenceViewSite-wide autocomplete across opted-in model-router list views.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- property codename¶
URL segment with the
viewsuffix removed from the class name.
- djcrud_dal_topbar.lookup.find_detail_url(model, pk)[source]¶
Return the detail page path for model/pk, or None.
- djcrud_dal_topbar.lookup.iter_model_routers(router)[source]¶
Yield every
ModelRouterunder router.
- djcrud_dal_topbar.lookup.iter_searchable_list_views(request)[source]¶
Yield list views opted into site search with permission and search_fields.
- djcrud_dal_topbar.lookup.get_list_queryset(list_view)[source]¶
Scoped queryset for site search (same view permission as list/detail).
- djcrud_dal_topbar.lookup.apply_search(qs, search_fields, term)[source]¶
Filter qs with icontains OR across search_fields for term.
- djcrud_dal_topbar.lookup.mixup_querysets(qs, paginate_by)[source]¶
Return a queryset with a few results from each sub-queryset.
- djcrud_dal_topbar.lookup.build_site_search_queryset(request, q, *, mixup=False, paginate_by=10)[source]¶
Build a
QuerySetSequencefor site search.
Site search¶
SearchView renders paginated results at
/search/. SiteSearchView serves
autocomplete fragments at /search/autocomplete/.
Opt models into site search with add_search() in djcrud.py
(beside add_perm()). Row visibility reuses existing view
queryset scoping from add_queryset(). The navbar partial is
djcrud_dal_topbar/templates/djcrud/_site_search.html.