I installed this app and created triggers in my PostgreSQL DB.
models.py:
class PartnerSubGroup(models.Model):
@denormalized(models.CharField, max_length=100)
@depend_on_related('Partner')
def partner_count(self):
return str(Partner.objects.filter(group = self.id).count())
def __unicode__(self): # for admin -
THIS WORKS
return self.name + ' [' + str(Partner.objects.filter(group =
self.id).count()) + ']'
class Partner(models.Model):
name = models.CharField(max_length=30, unique=True)
group = models.ForeignKey(PartnerSubGroup)
...
partner_count does not increase when i am adding partners! i also
tried CountField('partner_set'), but it does not work too.
--
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.