Friday, April 22, 2011

How to register EmployeeAdmin using atributes in Person class

Hello!

I need register EmployeeAdmin using atributes in Person class:

My admin.py:

class EmployeeAdmin(admin.ModelAdmin):
list_display = ("name","date_inclusion")
ordering = ["-name"]
search_fields = ("name",)
list_filter = ("date_inclusion",)
list_per_page = 10

admin.site.register(Employee,EmployeeAdmin)

I got this exception:

Exception Value is:

EmployeeAdmin.list_display[0], 'name' is not a callable or an
attribute of 'EmployeeAdmin' or found in the model 'Employee'.

My models.py:

class Person(models.Model):
name = models.CharField(max_length=50)
date_inclusion = models.DateField()

class Employee(models.Model):
person = models.OneToOneField(Pessoa)

I reed this doc http://docs.djangoproject.com/en/dev/ref/contrib/admin/
but could not find this information.

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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate