If you had a model called Flight which has two fields, one called "total_time", and the other called "distance", you could create a "speed" field like so:
Flight.objects.extra(select={'speed': 'distance / time'}) Each object will now have a 'speed' field. What if one of those fields is a result of an annotation? In my particular case, 'distance' is stored as an attribute of a Route object which is attached to Flight via Foreign Key. Flight.objects.annotate(distance=Sum('route__distance')).extra(select= {'speed': 'distance / time'}) which doesn't work. How can this be achieved? Or is it even possible? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.