Hi there,

Here I am trying to use the aggregate functions available in SVN trunk
(I am not sure if they have been released).  The following is a
simplified version of the models involved:

class Edition(models.Model):
    edkey = models.TextField()

class TextChar(models.Model):
    edition = models.ForeignKey(Edition)
    char= models.TextField(blank=True)
    unichar = models.ForeignKey(Char)

class Char(AdminMetadata):
    unicode = models.CharField(max_length=7, blank=True)

and here is what I am trying to do with them:

In [55]: c = Char.objects.get(pk=1)
In [56]: c.textchar_set.values('edition').annotate(Count('char'))
Out[56]: [{'char__count': 46, 'edition': 1}, {'char__count': 1,
'edition': 2}]

So I want to find out how many characters do occur in which edition
and I get the result as expected.  However, instead of the edition
objects, what I get back are the pk values of the edition.  Is there a
way to change this so that I get the objects that can be rendered in a
template?

Any help appreciate, Ctop
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to