votes up 2

Cannot parse keyword query as dict

Package:
django
github stars 59414
Exception Class:
FieldError

Raise code

""" 
        The 'can_reuse' is a set of reusable joins for multijoins.

        The method will create a filter clause that can be added to the current
        query. However, if the filter isn't added to the query then the caller
        is responsible for unreffing the joins used.
        """
        if isinstance(filter_expr, dict):
            raise FieldError("Cannot parse keyword query as dict")
        if isinstance(filter_expr, Q):
            return self._add_q(
                filter_expr,
                branch_negated=branch_negated,
                current_negated=current_negated,
                used_aliases=can_reuse,
                allow_joins=allow_joins,
😲 Agile task management is now easier than calling a taxi. #Tracklify

Ways to fix

votes up 1 votes down

import django.db.models.sql as sq

Error:

sq.query.Query([]).build_filter({}) <-- arg is dictionary

Solution:

sq.query.Query([]).build_filter([]) <-- above mentioned error wont occur
Jul 12, 2021 razafaizan72 answer

Add a possible fix

Please authorize to post fix