1
IndexError at /delta/ list index out of range. means that there is not data that was found by your model. You might want to look into your db to see whether those Ids
exist or not. As per your code, there are no errors, so plz look at Aircraft.objects.filter(id__in=ids)
a little more in deep.
Also its a good approach to use len(aircraft_to_compare)
to check whether any data is present or not.
Hope this helps.
0
You may not have found any records in the query
aircraft_to_compare = Aircraft.objects.filter(id__in=ids)
Check the length of aircraft_to_compare
or use try...except
block while accessing items from that queryset.
- Extracting a nested list with Django and replacing values
- Django rest framework – filtering against date query parameter
- Uploading a file using django
0
In Views,
You are creating a list data=[]
, then you are appending some values in that list. So the problem is when the list is appended to its max length there is no space left to append more values "list out of range". You can try to make the list empty after each operation(comparison) using data.clear() .
- Is there an easier way to either create or re-write exist object? django
- Django: cretae new object with unique order
- Django. Print all admin actions.
- Browserify doesn't works in Docker container
- How to return JSON Response correctly in joining multiple table in Django