删除django rest框架中按id进行的默认筛选

删除django rest框架中按id进行的默认筛选,django,django-rest-framework,Django,Django Rest Framework,如何在django rest框架中通过id删除默认筛选?我想禁止(或者改为通过\u uid字段过滤)这样的请求http://server/api/employee-list?employee=2 我编写了自定义筛选器并将其添加到视图中的filter\u类中: class EmployeeFilter(filters.FilterSet): class Meta: model = Employee fields = { 'uid':

如何在django rest框架中通过
id
删除默认筛选?我想禁止(或者改为通过
\u uid
字段过滤)这样的请求
http://server/api/employee-list?employee=2

我编写了自定义筛选器并将其添加到视图中的
filter\u类中

class EmployeeFilter(filters.FilterSet):
    class Meta:
        model = Employee
        fields = {
            'uid': ['exact', 'in'],
            'birth_date': ['day', 'month'],
            'first_name': NAME_FILTERS,
            'last_name': NAME_FILTERS,
            'middle_name': NAME_FILTERS,
        }

但是仍然能够通过
id

进行过滤这是否有用?您在DRF中默认通过
id
进行过滤是什么意思?@jerinterGeorge我没有通过
id
进行过滤。我甚至不在API中显示
id
,但如果我发出请求
?employee=
它会通过
id
进行过滤。您能显示您的模型和视图吗?