Non-relational field given in select_related: ' '. Choices are: (none) Non-relational field given in select_related: ' '. Choices are: (none) django django

Non-relational field given in select_related: ' '. Choices are: (none)


In select_related only fields that are ForeignKey should be set. In your case the issue it that date field is a DateTimeField and not ForeignKey.

So in order to solve it just do it:

new_context = Sensor.objects.select_related('measure')

You can see examples of using syntax in docs.