Skip to content

[FEATURE] filter on unrelated model #20

@Maarten-vd-Sande

Description

@Maarten-vd-Sande

Is your feature request related to a problem? Please describe:

I admit I am doing some unconventional stuff. But I have a Django admin app where I also have some visualzations. These visualzations put together data from multiple sources, and are not in the database itself. It would be nice if on these visualzation pages, I could refer to any one model and have an (ajax) autocompletefilter.

Describe the solution you'd like:

Something along the lines of:

class ExperimentFilter(UnrelatedFieldAjax):
    model = Experiment
    field = "name"


@admin.register(PlateInspectorViz)
class PlateInspectorAdmin(admin.ModelAdmin):
    change_list_template = "dashboard/plot.html"
    list_filter = [
        ExperimentFilter
    ]

Maybe something like this is already possible? But I haven't been able to figure out how to do this.

The filter wouldn't have to actually filter anything, except have nice autocomplete function and change the URL depending on the choice.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions