Karen, Luke, thank-you both for replying. Luke, there isn't an error message as such, it's just that the Entry model disappears from the admin. If I try to go directly to an entry page URL I get a 404. As soon as I go back to using list_filter = ('competition', 'division') it's ok. I've tried ('Competition.startDate', division) as you suggested, ('self.competition.startDate', division) and ('entry.competition.startDate', division). None of them work.
Karen, sounds like you might be right. If I can have a foreignKey field in list_filter that would mean 'competition' is ok, but 'competition.startDate' isn't a foreignKey, right? Any other suggestions? Thanks again, Steve On 28 July, 00:37, Karen Tracey <kmtra...@gmail.com> wrote: > On Mon, Jul 27, 2009 at 6:01 PM, irishsteve <steve...@gmail.com> wrote: > > > Hi > > > I'm new to Django, so thanks in advance for taking the time to help > > me! I can't work out how to reference a foreignKey in the list_filter > > method. > > > Here are the two relevant objects from my model: > > > [snip] > > Everything is working correctly however, in the list_filter method, > > > I've been trying to do: > > > list_filter = ('competition.startDate', 'division') > > > but it's just throwing an error. I've done quite a lot of digging > > about and I'm sure the answer is staring me in the face, but I haven't > > been able to work it out. > > You are trying to filter on a field in the related model? I do not get the > impression from the documentation for list_filter > (http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contri...) > that that is supported. It states: > > "(list_filter) should be a list of field names, and each specified field > should be either a BooleanField, CharField, DateField, DateTimeField, > IntegerField or ForeignKey." > > So, specifying the ForeignKey "competition" should work, but I'm not sure > there is any support for trying to follow that ForeignKey and filter on the > value of a field in the related model. > > Karen --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---