I am attempting to evaluate some generalization schemes using Django.
In particular, I'd like to create a new field (generalized race), and
then find a total population using the values() function as follows:
1 r = Records.objects
2 r = r.extra(select={'generalized_race: "CASE race WHEN 'Black' THEN
'B' WHEN 'White' THEN 'W' ELSE 'O' END"})
3 fields = ['age', 'sex', 'generalized_race']
4 r = r.values(*fields).annotate(Pop = Sum('population'))
The creation of the extra fields does not seem to be registered in any
way with Django, so it doesn't know what to do in line 4. Is there
any way around this? Can someone suggest an alternate approach?
Thanks,
~Kathy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---