Hello, I'm not entirely sure what the problem is, but as it stands, i'm fairly confident this stupid little line of code i have should work. The relevant models are:
class Encounter(models.Model): service = models.IntegerField(max_length = 100, blank=True) patient = models.ForeignKey(Patient) day = models.DateField() class Admin: pass def __unicode__(self): return self.patient.name class Service_details(models.Model): name = models.CharField(max_length = 18, blank=True) encounter = models.ForeignKey(Encounter) attended = models.BooleanField(default = False) class Admin: pass def __unicode__(self): return self.name And all i'm trying to do is sort "Service_details" by Encounter.day, and the line i'm trying to do it with is: Service_details.objects.filter(encounter__day=date) where date is of the form 'YYYY-MM-DD,' but i always receive the error "TypeError: Related Field has invalid lookup: day." This is a little confusing to me as i'm staring at the day attribute in the Encounter model right now. Any thoughts or help would be greatly appreciated. Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---