how do i obtain a constant column in a django orm?

When executing your code, I get the following error:

FieldError('Cannot resolve expression type, unknown output_field')

Which means django doesn’t know the type that your annotated field should result in.

To fix this, you need to wrap your annotation in an ExpressionWrapper:

from django.db.models import Value, ExpressionWrapper


CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top