coleifer/django-completion — Issue #7: Ability to do related queries
Author: stormlifter
Created: 2012-02-06 19:01:04+00:00
State: open

I'm not sure how this would work so maybe we can work on this feature together.

```
class University(models.Model):
"""
The university model is one-per university represented in the system
"""
name = models.CharField(max_length=250)

class Meta:
verbose_name_plural = 'Universities'

def __unicode__(self):
return u'%s' % self.name

class UniversityClass(models.Model):
"""
The model::UniversityClasses is one-per university-per-class.

So there may be multiple "Anthropology 101" classes, but only one per university
"""
name = models.CharField(max_length=250)
university = models.ForeignKey(University)

class Meta:
verbose_name_plural = 'University Classes'

def __unicode__(self):
return u'%s' % self.name
```

So let's say that and we want to have an autocomplete that can return all the classes available in a particular university. It doesn't seem like the system supports the ability to do anything like that.

Would it just be best to do the filtering you need after it is returned by 'site.suggest()' or could we incorporate it deeper?