I'm having a similar (but not identical) problem.

In my app I have Rate's that belong to a Rateset, and Card's that use a
Rateset. So both Rate and Card have a foreign key connection to
Rateset.

My application needs a list of "active" rates (those rates that are in
use by an active Card).  Here is my query:

Rate.objects.filter(rateset__card__active_exact=True).distinct().values('countryfrom')

I'm trying to follow the relationship from Rate, "forward" to Rateset
and "reverse" to Card. I get:

AttributeError: 'RelatedObject' object has no attribute 'column'

Any idea of what's wrong?

Thanks, Rick

<<<< Model >>>>>

class RateSet(models.Model):
    description = models.TextField(maxlength=128)

class Continent(models.Model):
    id = models.TextField(maxlength=2, primary_key=True)
    description = models.TextField(maxlength=40)

class Country(models.Model):
    id = models.TextField(maxlength=3, primary_key=True)
    continent = models.ForeignKey(Continent)
    description = models.TextField(maxlength=40)

class Rate(models.Model):
    rateset = models.ForeignKey(RateSet)
    countryfrom = models.ForeignKey(Country,
related_name='countryfrom_set')
    countryto = models.ForeignKey(Country,
related_name='countryto_set')
    perminute = models.FloatField(max_digits=6, decimal_places=4)

class Card(models.Model):
    rateset = models.ForeignKey(RateSet)
    name = models.CharField(maxlength=24)
    active = models.BooleanField()


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to