ImportError: cannot import name 'Random' from 'django.db.models.functions'

Well, I am trying to run my django project in new environment, I installed all of my requirements although every package is installed but it is still giving me below mentioned error. I am not sure but I am guessing it is due to version conflict of some modules. Can anyone help me out? Thanks in Advance :) error thrown by compiler

I looked for existing solutions or someone who faced similar situation but no success.

the Random method is located in django/db/models/functions/ . change your import statement to this :

from django.db.models.functions.math import Random
Back to Top