I think this might be a bug in source code, but before I report a ticket I thought I would ask just to ensure it's not me doing something wrong/stupid.
In brief, I have a (MySQL) database table containing latitude and longitude columns. I am finding records from this table and sorting them based on distance, and to do this I'm adding a custom column in the select statement using the extra() QuerySet function. So here's the relevant code for this part: entries = Entry.objects.filter(type='country') entries = entries.extra(select={'distance': "SQRT(POW((locations.lat- %s),2) + POW((locations.lon-%s),2))"}, select_params=(str(centerLat), str(centerLng))) entries = entries.extra(order_by = ['distance'])[:100] In a nutshell, this code defines a custom column "distance" and uses some MySQL numeric functions to calculate a hypotenuse to get the distance value. The result set is ordered by this column. This works great. Now for the issue...when I serialize this code as follows: from django.core import serializers json_serializer = serializers.get_serializer("json")() json_serializer.serialize(entries, ensure_ascii=False, stream=response, fields=('title','lat','lon','distance')) The problem being that the "distance" column does not end up getting included in the json output. The other columns are included, however, no problem. I have even inspected the queryset in entries an confirmed that each object does in fact contain a distance attribute, as a float, which is set properly. So....finally to my question...is there an issue of some kind with the way the serializer handles extra fields, or am i just doing it wrong? FYI i'm on the latest release Django version 1.0-beta_1-SVN-8539. Thanks for any help or suggestions you guys can provide! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---