Closed specialorange closed 6 years ago
from accounts import models as AccountModels
@admin.register(AccountModels.Account)
class AccountAdmin(admin.ModelAdmin):
list_display = ['slug', 'active', ]
active
in the list display refers to the ActiveManager
instance, what you want here is the is_active
field name I think.
I have tried my best, but some concepts seem to be evading me. I appreciate your work and help. Thanks!
Related issues?
I am not sure, but from what I am reading in the source, this seems related to #161 and #154 .
Stack Overflow
https://stackoverflow.com/questions/52526388/manager-isnt-accessible-via-account-instances
In using django-organizations to give my project organizations, I made a separate app for accounts.
Using the code from the docs (https://django-organizations.readthedocs.io/en/latest/cookbook.html#advanced-customization-using-abstract-models) in what I assume is a basic case, I am trying to add them on
the
admin.py
page:This gives an error when trying to view the list on admin page for Accounts (at
http://localhost:8000/adminaccounts/account/
) [ps - theadd
page renders, but will provide the same error on save]:Looking at the error, I am not supposed to be calling it on an instance, rather only a Class. But the default admin template is rendering this page, so I am wary of editing that. Is there something I am missing related to setting up an inherited class in an admin class? (the organization-user and organization-owner both display properly adding to my confusion)
This is the stack that shows that it is trying to access an instance (but I can't find in the stack trace which line is the producing the error, only that it is in the
{{content}}
part of the template block):The accounts
models.py
(just the same as the docs):I do not have any functional views or Class based views in the
accounts
app, so I don't know if I am supposed to override a manager or search query or view...Trying to override the view(?) of the admin :
This either produces the previous error, or
type object 'Account' has no attribute 'filter'