我想在我的管理器上扩展_filter_or_exclude方法,但由于某些原因,该方法从未被调用过。我想要实现的是隐式过滤模型,这些模型没有字段deleted =0(使用所有的get()、filter()、all()和exclude()以及可能的其他方法) 我的模型 from django.db.modelsimport Model, Manager, Q, QuerySet
CustomModelManager被定义为只会带来状态为==‘active’的记录: def get_queryset_db).filter(state='active') Person ID 1 state = 'active'
Image ID 1 state = 'inactive,因为我使用objects
我正尝试在Django中动态构建一个查询。我有很多想要为其构建查询的模型,但我不想编码模型的名称,我想将其作为字符串传递。from django.db.models.query import QuerySeta_doesnt_work = QuerySet("model_A") # I want this to work, too
a_