Hi,

I'm very new to Django, and I'm a bit overhelmed with doc, so I might
have missed something. Thanks for redirecting me then :-)

I've this model (simplified):

class Department(models.Model):
    name = models.CharField(maxlength=10,primary_key=True)
    class Admin:
        pass

class Job(models.Model):
    name = models.CharField(maxlength=30,primary_key=True)
    department = models.ForeignKey(Department)
    class Admin:
        pass

class Person(models.Model):
    name = models.CharField(maxlength=30,primary_key=True)
    job = models.ForeignKey(Job)

    def _get_branch(self):
        return Job.objects.select_related().get(name=self.job.name).department
    department = property(_get_department)

    class Admin:
        list_display = ('name','job','department')
        list_filter = ('job','department')
        search_fields = ('name')

My problem is that 'department' in list_display works just great,
while in list_filter in makes an error:
Request Method:         GET
Request URL:    http://127.0.0.1:8000/admin/unitmanager/unit/
Exception Type:         FieldDoesNotExist
Exception Value:        name=branch
Exception Location:     c:\program
files\python24\lib\site-packages\django-0.91-py2.4.egg\django\db\models\options.py
in get_field, line 97

Why is there an error? Is there a way to do what I want?

Thanks,

G

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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