Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when registering positionField in django-admin #70

Open
havelio opened this issue Aug 12, 2020 · 0 comments
Open

Error when registering positionField in django-admin #70

havelio opened this issue Aug 12, 2020 · 0 comments

Comments

@havelio
Copy link

havelio commented Aug 12, 2020

i try registering positionField like this

class SomeModelAdmin(admin.ModelAdmin):
    list_display = ['position']

admin.site.register(SomeModel, SomeModelAdmin)

and I get error message:

django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:

ERRORS:
<class 'project.some_models.admin.ModelAdmin'>: (admin.E108) The value of 'list_display[0]' refers to 'position',
which is not a callable, an attribute of 'ModelAdmin', or an attribute or method on 'some_models.SomeModel'.

I handled the error with this:

class SomeModelAdmin(admin.ModelAdmin):
    list_display = ['get_position']

    def get_position(self, obj):
        return obj.position

admin.site.register(SomeModel, SomeModelAdmin)

but it's really confused because it not shown on the documentation
it would be nice if the library could handle that error itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant