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:

class Competition(models.Model):
    name = models.CharField("Event title", max_length=200)
    startDate = models.DateTimeField('Competition start date')
    divisions = models.ManyToManyField(Division)

    def __unicode__(self):
        return self.name

class Entry(models.Model):
    member = models.ForeignKey(Member)
    competition = models.ForeignKey(Competition)
    division = models.ForeignKey(Division, null=True, blank=True)
    finishPosition = models.IntegerField("Finishing position",
null=True, blank=True)
    description = models.TextField("Update", null=True, blank=True)

    class Meta:
        verbose_name_plural = "entries"
        unique_together = ['member','competition']

    def __unicode__(self):
        return self.member.get_formatted_name()





Then I have a few modelAdmin classes, here is the problematic one:

class EntryAdmin(admin.ModelAdmin):
    fieldsets = [
        ("Event entrant details", { "fields": ("member",
"competition", "division")}),
        ("Event results information", {"fields": ("finishPosition",
"description")})
    ]

    list_display = ('member', 'competition', 'division')
    ordering = ('member',)
    list_filter = ('competition','division')

admin.site.register(Entry, EntryAdmin)


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.

Many thanks,
Steve


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

Reply via email to