> q="select SUM(quantity) as item_count from %s where order=%s" % > (self.orderitem_set.model._meta.db_table,self._get_pk_val())
Sorry, that first one is wrong. q="select SUM(quantity) as item_count from %s where order_id=%s" % (self.orderitem_set.model._meta.db_table,self._get_pk_val()) I wish I knew how to get 'order_id' from the meta info like you can get get the db table, but using foreignkeyfieldname_id give you the default column name. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---