Skip to content
  • Alex Pyrgiotis's avatar
    admin: Use abbreviations for all model filters · 8ef7f5a5
    Alex Pyrgiotis authored
    Normally, we would like to name our model filters more verbosely: e.g.
    proj --> project, net --> network. However, django-filter fails to
    understand that the filter we create has nothing to do with the actual
    model field and crashes, if defined like so:
    
        project = django_filters.ChartFilter(..., action=my_action)
    
    If we try to circumvent it like so:
    
        proj = django_filters.ChartFilter(..., name='project',
                                          action=my_action)
    
    then no results are printed since the query value gets incorrectly
    cleared by the FilterSet form.
    
    There doesn't seem to be an easy or clear way to circumvent this issue
    so, for now, use as filter names the abbreviations of their model names
    in order to be consistent across views.
    8ef7f5a5