Reputation: 368
I came through a problem which I never happened to face before in Django queryset. I have more then 1,00,000 of floating point datatype (records) along with foreign key field in one data model class. What I am trying to do is query on these records with following procedure.
So, please only focus on querying on such range after decimal point (fixed) ?
If question is not clear enough please do comment. I will again try my best.
Guide me
Upvotes: 1
Views: 6063
Reputation: 44132
If you have the high and low ends of your range already computed, then you can use a simple range query in Django:
objects = my_model.objects.filter(field__gte=LR, field__lte=HR)
or, somewhat shorter:
objects = my_model.objects.filter(field__range=(LR, HR))
(You'll have to replace 'my_model' and 'field' with your actual model and field names, of course)
Upvotes: 8