class RulesObjectType(DjangoObjectType): class Meta: abstract = True @classmethod def get_queryset(cls, queryset, info): q = super().get_queryset(queryset, info) if not hasattr(cls._meta, "queryset_rule") or getattr(cls._meta, "queryset_rule") is None: raise NotImplementedError( f"Graphql type {cls.__name__} implementing RulesObjectType must provide a queryset_rule via Meta.", ) return queryset_rules_filter(info.context, q, getattr(cls._meta, "queryset_rule"))
Sadly does not work, because for some reason, cls._meta does not recognize meta attributes that are set in the subclass but not in the parent class, but due to abstract = True I cannot set the attribute myself…