B
B
Bobsans2018-08-21 02:30:04
PostgreSQL
Bobsans, 2018-08-21 02:30:04

Can you help me convert PostgreSQL query to DjangoORM syntax?

Dear experts, do not tell me how to rewrite this query in the Django ORM style:

SELECT * 
FROM records_status rs 
WHERE company_id = (
    SELECT company_id 
    FROM customauth_user 
    WHERE 
        id = 4 AND 
        (
            is_superuser = true OR 
            NOT (permissions ? CONCAT('records.', rs.key, '.denied'))
        )
)

I know that you can .raw(), etc. But it is interesting whether it is possible to do such things by means of QuerySet.
Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question