piyush singh
piyush singh

Reputation: 435

NameError: name 'QuerySet' is not defined

I'm getting the NameError: name 'QuerySet' is not defined error in below line.

QuerySet(query=MappingTraineeQ.objects.filter(date__range=(startdate,enddate)).query, model=MappingTraineeQ)

I'm not getting the problem, do I need to import anything for this? or I missed something.

please help me with the above.

Thanks

Upvotes: 5

Views: 5110

Answers (1)

zaidfazil
zaidfazil

Reputation: 9235

You could import Queryset like,

from django.db.models.query import QuerySet

Upvotes: 5

Related Questions